PDA

View Full Version : [CLOSED] ASP.NET Form Validation Request error when closing a Window containing a TextArea



aengels
Aug 25, 2014, 2:05 PM
When I run this code (press the button) I get a validationrequest error. How can get rid of this error without switching of this ASP.NET security feature.? It works fine when I use a Label instead of a TextArea.


protected void ErrorButton_Click(object sender, DirectEventArgs e)
{
this.IncidentErrorWindow.Close();
this.IncidentTabPanel.Enable();
}



<ext:Window runat="server" ID="IncidentErrorWindow" Title="Error Message" Hidden="true" Width="330" Icon="cancel" Closable="false">
<Items>
<ext:FormPanel runat="server" Border="False" Padding="5" DefaultAnchor="100%" BodyStyle="background-color: #E0E0E0;" ButtonAlign="Center">
<Items>
<ext:TextArea runat="server" ID="IncidentErrorMessage" MinHeight="120" ReadOnly="true" Margin="5" AutoScroll="true" />
</Items>
<Buttons>
<ext:Button runat="server" ID="IncidentErrorButton" Text="OK" >
<DirectEvents>
<Click OnEvent="ErrorButton_Click" />
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>

geoffrey.mcgill
Aug 25, 2014, 10:39 PM
The TextArea is being submitted during the DirectEvent request, which triggers the RequestValidation.

The following link provides information on how to disable RequestValidation:

http://www.asp.net/whitepapers/request-validation

aengels
Aug 25, 2014, 11:30 PM
Is there any way we can HTML-encode Direct Events somehow to comply with the .NET security? Also I think this is a better link as it explains how to disable Request Validation in .NET 4 (http://msdn.microsoft.com/en-us/library/hh882339(v=vs.110).aspx) or later :-)

Thank you,
Aaron

geoffrey.mcgill
Aug 26, 2014, 12:29 AM
Well, you could get the TextArea value, then encode it and set it back, in the .Before handler of the Button.