System.Web.HttpRequest.ValidateInput C# (CSharp) Method

ValidateInput() public method

public ValidateInput ( ) : void
return void
		public void ValidateInput ()
		{
			validate_cookies = true;
			validate_query_string = true;
			validate_form = true;
#if NET_4_0
			inputValidationEnabled = true;
#endif
		}
#if NET_4_0

Usage Example

Example #1
0
		public void ValidateInput_XSS_Unicode ()
		{
			string problem = "http://server.com/attack2.aspx?test=%uff1cscript%uff1ealert('vulnerability')%uff1c/script%uff1e";
			string decoded = HttpUtility.UrlDecode (problem);
			int n = decoded.IndexOf ('?');
			HttpRequest request = new HttpRequest (null, decoded.Substring (0,n), decoded.Substring (n+1));
			request.ValidateInput ();
			// the next statement throws
			Assert.AreEqual ("\xff1cscript\xff1ealert('vulnerability')\xff1c/script\xff1e", request.QueryString ["test"], "QueryString");
		}
All Usage Examples Of System.Web.HttpRequest::ValidateInput