Today i was stucked in one issue after converting my website from .net2.0 to 4.0.
In .net2.0 page is working fine with ValidateRequest="false" but after converting to 4.0 it's throwing error
Sys.WebForms.PageRequestManager.prototype._endPostBack ScriptResource.axd
Sys.WebForms.PageRequestManagerServerErrorException:An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
I tried different way to solve the issue but no luck.at the end i tried to remove ValidateRequest="false" attribute from page and then i got actual error which is that "Potentially dangerous Request.Form value was detected"
It was because i am storing some xml values in hidden field.but the strange in .net2.0 it was working fine then what is the issue in 4.0.
I think in .net4.0 Microsoft has change some logic of validating request of web page.
So currently i have 2 solution to solve the issue.
1. Change the code and remove xml things from hidden variable.
2. I can validate page request as per .net framework 2.0
So Solution no 2 is better for me.
I have added following attribute to web.config
In .net2.0 page is working fine with ValidateRequest="false" but after converting to 4.0 it's throwing error
Sys.WebForms.PageRequestManager.prototype._endPostBack ScriptResource.axd
Sys.WebForms.PageRequestManagerServerErrorException:An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
I tried different way to solve the issue but no luck.at the end i tried to remove ValidateRequest="false" attribute from page and then i got actual error which is that "Potentially dangerous Request.Form value was detected"
It was because i am storing some xml values in hidden field.but the strange in .net2.0 it was working fine then what is the issue in 4.0.
I think in .net4.0 Microsoft has change some logic of validating request of web page.
So currently i have 2 solution to solve the issue.
1. Change the code and remove xml things from hidden variable.
2. I can validate page request as per .net framework 2.0
So Solution no 2 is better for me.
I have added following attribute to web.config
<httpRuntime requestValidationMode="2.0"/>
No comments:
Post a Comment