Google Brother Up

2009/02/13

A potentially dangerous Request.Form value was detected from the client... (Solution - Solved)

When you come across an error saying "A potentially dangerous Request.Form value was detected from the client..." you can be very sure that you need to do 2 things to solve it.

1) Set the aspx page set ValidateRequest="false" so that the page directive looks like this: - {%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddPressRelease.aspx.cs"
Inherits="AddPressRelease" ValidateRequest="false" %}

2) While submitting the page inside the submit method html encode all textboxes like below: -

objPressReleaseBO.Title = Server.HtmlEncode(txtTitle.Value);
objPressReleaseBO.Description = Server.HtmlEncode(txtDescription.Value);

Your problem will be solved. :)

186 unique visitors

No comments:

Drop Down List

1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx