Fix for - A potentially dangerous Request.Form value was detected from the client

Error Message: A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$txtMetaTags="

Stack Trace: at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName) at System.Web.HttpRequest.ValidateNameValueCollection(NameValueCollection nvc, String collectionName) at System.Web.HttpRequest.get_Form() at System.Web.HttpRequest.get_HasForm() at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) at System.Web.UI.Page.DeterminePostBackMode() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.admin_globalsettingsedit_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3aac8a26\4063e85f\App_Web_globalsettingsedit.aspx.fdf7a39c.2o43twuy.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Solution:

Put validateRequest="false" in your page directive or web.config file which looks like below:

<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" Inherits="JXTPortal.Website.Admin.GlobalSettingsEdit" Title="GlobalSettings Edit" Codebehind="GlobalSettingsEdit.aspx.cs" %>
PS: For security reasons you don't want to disable the validation then try encoding the value. (use Html encode)

Share item with friends