error while post back the page if any input control(textBox) has value &#

Im working in 2.0 and Ajax 1.0
Im getting error while post back the page if any input control(textBox) has value &#
im not getting error even it has value #&
 Please help....
11/13/2008 6:46:23 AM
📃 9760 articles.

💬 2 Replies

Hi ajith P T

The “&#” is a special word in HTML, it might be forbid during the postback because of the security issue.
If you need this in your TextBox, you can set the ValidateRequest="false" on your <%@ Page %> tag to avoid the error.
Just like the following demo:
&lt;%@ Page Language=&quot;C#&quot; ValidateRequest=&quot;false&quot; %&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;;&gt;

&lt;script runat=&quot;server&quot;&gt;


&lt;html xmlns=&quot;;&gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
        &lt;asp:TextBox ID=&quot;TextBox1&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;
    &lt;asp:Button ID=&quot;Button1&quot; runat=&quot;server&quot; Text=&quot;Button&quot; /&gt;


Lance Zhang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
11/17/2008 4:47:20 AM
You can disable request validation by setting the validateRequest attribute in the @ Page directive to false, as shown in the following example: 

<%@ Page validateRequest="false" %>
To disable request validation for your application, you must modify or create a Web.config file for your application and set the validateRequest attribute of the pages section to false, as shown in the following example:
    <pages validateRequest="false" /> 

This Indicates whether request validation should occur. If true, request validation checks all input data against a hard-coded list of potentially dangerous values. If a match occurs, an HttpRequestValidationException exception is thrown. The default is true.

This feature is enabled in the machine configuration file (Machine.config). You can disable it in your application configuration file (Web.config) or on the page by setting this attribute to false.

Chetan Sarode
Software Engineer,
Approva Systems Pvt Ltd,
Pune, India.
11/18/2008 3:38:40 AM

Similar Artilces: