locked
Input string was not in a correct format.An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code RRS feed

  • Question

  • User922310640 posted

    hello all please help me with this error,

    Input string was not in a correct format.              Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            
    Exception Details: System.FormatException: Input string was not in a correct format.
    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
                      

    Stack Trace:

    [FormatException: Input string was not in a correct format.]
       System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7470855
       System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
       System.Convert.ToInt32(String value) +63
       Infragistics.WebUI.UltraWebListbar.UltraWebListbar.getRenderer() +237
       Infragistics.WebUI.UltraWebListbar.UltraWebListbar.get_IsAppStyling() +28
       Infragistics.WebUI.UltraWebListbar.UltraWebListbar.OnPreRender(EventArgs e) +73
       System.Web.UI.Control.PreRenderRecursiveInternal() +80
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
    

     

    I can open a website locally but when try to open it remotely this error appear

                

    Friday, February 13, 2015 2:03 PM

Answers

  • User281315223 posted

    Do you have any code related to where this issue is occurring?

    Based on the StackTrace that you provided it sounds like you have some code that is attempting to convert some type of string value into a number (e.g. an integer, decimal, double, etc.) and the value that is being passed in isn't in the correct format and cannot be parsed as a proper numerical value.

    Without seeing any exact code or where this could be getting called from, it's difficult to say what could cause it or how you might fix it. You might consider using a method like the TryParse() methods to ensure that your input is in the appropriate format instead of the Convert() methods as seen in the example below :

    // Use a temporary value to store your result
    int i = 0;
    
    // Instead of using the Convert.ToInt32(input); method, you can use the Int32.TryParse() method which will
    // return a boolean indicating if your parse was successful or not
    if(Int32.TryParse(input, out i))
    {
         // If this executes, the parsing was correct and your proper value will be stored in the variable 'i' 
         // defined above
    }
    else
    {
         // Otherwise, the input could not properly be parsed, throw an error or notify the user
    }

    I noticed that there is some Infragistics code in your StackTrace as well. If you are using some of their components, it could be possible that this issue may be related to some of their code as well. You may want to consider consulting their support team if you feel that is a possibility.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 13, 2015 3:25 PM
  • User-1716253493 posted

    try check culture like this

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Response.Write(string.Format("culture:{0} and uiculture:{1}",Culture,UICulture));
            }
        }

    in working server, now set culture and uiculture in web.config same with above results

    https://msdn.microsoft.com/en-us/library/bz9tc508(v=vs.140).aspx

    Another posible issue, maybe there is null value that causing above error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 13, 2015 8:22 PM

All replies

  • User281315223 posted

    Do you have any code related to where this issue is occurring?

    Based on the StackTrace that you provided it sounds like you have some code that is attempting to convert some type of string value into a number (e.g. an integer, decimal, double, etc.) and the value that is being passed in isn't in the correct format and cannot be parsed as a proper numerical value.

    Without seeing any exact code or where this could be getting called from, it's difficult to say what could cause it or how you might fix it. You might consider using a method like the TryParse() methods to ensure that your input is in the appropriate format instead of the Convert() methods as seen in the example below :

    // Use a temporary value to store your result
    int i = 0;
    
    // Instead of using the Convert.ToInt32(input); method, you can use the Int32.TryParse() method which will
    // return a boolean indicating if your parse was successful or not
    if(Int32.TryParse(input, out i))
    {
         // If this executes, the parsing was correct and your proper value will be stored in the variable 'i' 
         // defined above
    }
    else
    {
         // Otherwise, the input could not properly be parsed, throw an error or notify the user
    }

    I noticed that there is some Infragistics code in your StackTrace as well. If you are using some of their components, it could be possible that this issue may be related to some of their code as well. You may want to consider consulting their support team if you feel that is a possibility.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 13, 2015 3:25 PM
  • User922310640 posted

    thanks for u reply,

    actually I am not the developer of the site so, I do not know where to find that part of code but it works well locally (on the server side)

    Friday, February 13, 2015 3:54 PM
  • User-1716253493 posted

    try check culture like this

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                Response.Write(string.Format("culture:{0} and uiculture:{1}",Culture,UICulture));
            }
        }

    in working server, now set culture and uiculture in web.config same with above results

    https://msdn.microsoft.com/en-us/library/bz9tc508(v=vs.140).aspx

    Another posible issue, maybe there is null value that causing above error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 13, 2015 8:22 PM
  • User281315223 posted

    thanks for u reply,

    actually I am not the developer of the site so, I do not know where to find that part of code but it works well locally (on the server side)

    It's possible that it could also be a cultural issue, especially if the site is being hosted on a server that might use a different format for some values (depending on exactly what types of values are being parsed).

    Saturday, February 14, 2015 8:16 AM