Just came across this error when I upgraded my Blog from .NET 3.5 to .NET 4.0 - A potentially dangerous Request.Form value was detected from the client .....
Ok, so first I thought may be I missed the Page directives. Checked that and it was there, played around with different settings and configurations, but nothing helped.
But finally the solution was revealed:) and it was very simple as you can see below. In .NET 4.0, Microsoft added another parameter “requestValidationMode” in httpruntime which will stop this error. So open your web.config and add following.
- <system.web>
- <httpRuntimerequestValidationMode="2.0"/>
- </system.web>
Remember if your website is still using .NET 2.0 and getting the same error, make sure that the page directive “ValidateRequest” is set to false.
- <%@ Page Language="C#" MasterPageFile="masterPage.master" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" ValidateRequest="False" %>
No comments:
Post a Comment