find and solve ||
Please wait.....

Welcome back.

Before Read Terms of use

A Potentially Dangerous Request.form Value Was Detected From The Client

In the blog you will come know about how to remove this error while submitting a form to the server.

This error can occur in any page, but mostly a client receives this error while entering a replacement or modified item / product in admin panel of any portal because in admin panel we mostly write html code to fill in blanks, and also to display the merchandise feature in ordered or unordered list.

Error Description

ASP.NET has detected data within the request that's potentially dangerous because it'd include HTML markup or script.This error description means some one entered HTML markup or script which can be dangerous to the server.


Option 1.

[HttpPost, ValidateInput(false)]
public IActionResult Save(FormCollection collection)
    //so something here

In Visual Basic  example like as given below.

<AcceptVerbs(HttpVerbs.Post), ValidateInput(False)> _
Function Edit(ByVal collection As FormCollection) As ActionResult
   //so something here
End Function

Option 2.

In ASP.NET MVC  you can add the AllowHtml attribute to a property on your model.

public string Description { get; set; }

In core no need to Allowhtml

Option 3.

If you are on .NET  4.0 make sure you add this in your web.config file inside the <system.web> tags like as give below

<httpRuntime requestValidationMode="2.0" />

Mahira  khanna

Mahira khanna

I have the skills you need for you company blog, website, or other content materials


Report Response