开发者

"Sys.WebForms.PageRequestManagerServerErrorException: status code: 500"

I am using an asp.net text box inside ajax update panel. If I enter &# in the textbox and press Save Button , it giv开发者_如何转开发es a javascript error

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

Please help me why this error appears?

"Sys.WebForms.PageRequestManagerServerErrorException: status code: 500"


Probably ASP.NET Request Validation kicked in and detected a potentially dangerous request (the &# in the textbox value). This causes an HttpRequestValidationException to be thrown - hence the 500 HTTP code is returned by the UpdatePanel. The way I see it there are two ways to solve this problem:

  1. Validate the contents of the textbox and replace any potentially dangerous (HTML like) values.
  2. Disable request validation:

    <%@ Page ValidateRequest="false" %>

If you choose to disable request validation make sure that the value of this textbox is not output verbatim somewhere else in your application. Make sure you are using HttpUtility.HtmlEncode when displaying it in order to avoid XSS issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜