|
|
||||||
|
#1
|
|
|
|
|
Hi,
I've a simple web form (webform1.aspx) with a text box & button. The click event of the button appends the value of the text box to the URL and redirects to webform2.aspx. This then gets the value of the text box from the query string. I'd like to keep validateRequest=true to prevent malicious input. If the user does enter some invalid text, is there a way of catching the HttpRequestValidationException before it bombs out to the browser? I would then like to inform the user that their input is invalid. Alternatively, if I set validateRequest=false, is there a method to call (like System.Web.HttpRequest.ValidateString) that will do this so that I can catch any exceptions that are thrown? Thanks in advance, Regards John. |
|
|
|
#2
|
|
|
|
|
Hi John,
You try the Application_Error method in global.asax. Anyway, I think a Validator control may be better in this situation. You can choose valid user input on client side, so that we don't need to return to server; or you can use Custome Validator to perform the validate on server side and display proper message to customer. For more information for ASP.NET validator control, you may refer to: http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemwebuiwebcontrolsregularexpressionvalida torclasstopic.asp http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfSystemWebUIWebControlsCustomValidatorClassTop ic.asp Hope this help, Luke Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|
|
| Similar Threads | |
| Request Validation Hi guys I have a question regarding to how to do the request validation on user's input. We all know in asp.net. when user input something like <a>blah blah</a> by default,... |
|
| Redirecting Request Validation? Is there any way to redirect the output from Request Validation to an actual page of our choosing? |
|
| Request Validation. Can anyone tell me what is potentially dangerous with the following combination of letters "OnU=" |
|
| Request Validation Hi, can i disable RequestValidation per request somehow? regards henrik |
|
| Logon Request Validation I have a problem with a Win2000 Small Business Server running Active Directory that I cannot resolve. I have tried KB searches for info regarding this problem and... |
|
|
All times are GMT. The time now is 11:28 AM. | Privacy Policy
|