24 Mart 2016 Perşembe

A potentially dangerous Request.Form value was detected from the client hata çözümü

Yorum Bırak
Web uygulamalarında alınan bu hata server tarafına gonderilen veride tehlikeli olabilecek karakterler olması durumunda oluşmaktadır. Bunun çözümü için:

Web.confige aşağıdaki kodu ekleyebilrisiniz:

<configuration>
...
  <location path="MyFolder/.aspx">
    <system.web>
      <pages validateRequest="false" />
      <httpRuntime requestValidationMode="2.0" />
    </system.web>
  </location>
...
</configuration>



Artı olarak bu hatayı aldığınız metodun üzerine validateinput(false) attribute de eklenebilir.

[HttpPost, ValidateInput(false)]
public virtual ActionResult Edit(int id, FormCollection collection)
{
    ...
}






0 yorum:

Yorum Gönder