HttpApplication
httpApp = this.Context.ApplicationInstance;
HttpException
httpEx = httpApp.Server.GetLastError() as HttpException;
if
(httpEx != null)
{
if (
httpEx.WebEventCode ==
System.Web.Management.WebEventCodes.AuditInvalidViewStateFailure
||
httpEx.WebEventCode == System.Web.Management.WebEventCodes.InvalidViewState
||
httpEx.WebEventCode == System.Web.Management.WebEventCodes.InvalidViewStateMac
||
httpEx.WebEventCode ==
System.Web.Management.WebEventCodes.RuntimeErrorViewStateFailure
)
{
HttpContext.Current.ClearError();
Response.Write("Error: An invalid viewstate has been detected
(WebEventCode: " + httpEx.WebEventCode.ToString() + ").");
}
}
No comments:
Post a Comment