Rankun Posted October 14, 2005 Posted October 14, 2005 When I run my app on my local box it works fine. Whenever I run the app from the web, I get:"Server Error in ..." "Input string was not in a correct format." 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. This always happens whenever I click any button that requries validation. IE it should show text in the validation summary box that says something like "You must enter a number between 1 and 10", instead I get the above. Note:Web.config <customErrors mode="Off"/> Any have an idea of what I'm doing wrong? Thanks in Advance, Rankun Don't think this will help but, In case anyone wants to see the Stack Trace: [FormatException: Input string was not in a correct format.] Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +195 Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +82 [invalidCastException: Cast from string "" to type 'Double' is not valid.] Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +170 Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value) +7 FitFreak.Exercise.btnAddExercise_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\FitFreak\Exercise.aspx.vb:125 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292 __________________ Rankun Quote
mark007 Posted October 14, 2005 Posted October 14, 2005 Please post the code of this procedure: FitFreak.Exercise.btnAddExercise_Click(Object sender, EventArgs e) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Administrators PlausiblyDamp Posted October 14, 2005 Administrators Posted October 14, 2005 The line [invalidCastException: Cast from string "" to type 'Double' is not valid.] looks like you are passing an empty string somewhere when it should be a string containing a number. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Rankun Posted October 16, 2005 Author Posted October 16, 2005 The line looks like you are passing an empty string somewhere when it should be a string containing a number. Yes I am passing an empty string, on purpose. It should open up the summary validation box and give the user an error. IE You must enter a number. Again it works on the local box fine same code same inputs. Thanks for the help everyone, still looking for a solution. Quote
Administrators PlausiblyDamp Posted October 16, 2005 Administrators Posted October 16, 2005 What browser(s) have you tested this with? What are the security settings for the zone in which the page is running from? Is JavaScript enabled or not on the browser for this zone / site / url? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Rankun Posted October 16, 2005 Author Posted October 16, 2005 What browser(s) have you tested this with? What are the security settings for the zone in which the page is running from? Is JavaScript enabled or not on the browser for this zone / site / url? I am testing with IE 6.0 only, that is the only platform that will be used to access the program. Javascript is enabled. I am using the same box to test the app locally and from the web. Quote
Administrators PlausiblyDamp Posted October 16, 2005 Administrators Posted October 16, 2005 Is Javascript enabled for that URL or Zone though? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Rankun Posted October 16, 2005 Author Posted October 16, 2005 Is Javascript enabled for that URL or Zone though? Yes, I even added it to my trusted sites. Quote
Administrators PlausiblyDamp Posted October 17, 2005 Administrators Posted October 17, 2005 It definately looks like the client script isn't executing for some reason, are you getting any errors on the page? It may be worth checking that the .Net framework is correctly installed on the server and that nobody has accidently removed the aspnet_client directory. Also you shouldn't rely on just the client side scripts in case they are disabled on the browser anyway - on the server side you would need to check Page.IsValid before performing any operations that rely on user input. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Rankun Posted October 21, 2005 Author Posted October 21, 2005 It definately looks like the client script isn't executing for some reason, are you getting any errors on the page? It may be worth checking that the .Net framework is correctly installed on the server and that nobody has accidently removed the aspnet_client directory. Also you shouldn't rely on just the client side scripts in case they are disabled on the browser anyway - on the server side you would need to check Page.IsValid before performing any operations that rely on user input. Guess I'm confusing myself.... If I use page.isvalid is that going to make my validationsummary show the errors? Or do I need to manually create/code all my errors and get rid of the .net validators? I was thinking about just recoding my app to use text boxes with page.isvalid, but I thought since .net already had all these validators and summary validation it would be easier. Thanks again, Rankun Quote
Administrators PlausiblyDamp Posted October 21, 2005 Administrators Posted October 21, 2005 If you have validators on your form then they are always processed server side regardless of what the client is or does in terms of client side scripting. Page.IsValid doesn't really do anything itself it simply reports on if the page has any validators that failed their validation and if you prevent the page redirecting on a validation error then it should display the validation summary just fine. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.