locked
can't set httpRuntime requestValidationMode="2.0" in web.config RRS feed

  • Question

  • User-1522737762 posted

    Hi, 

    I'have issues to update my web application from 2.0 to 4.0. I requested an xml from another website but now it doesnt work anymore.

    I saw in server logs error 3003, I found out that I had to update my webconfig and add

    <httpRuntime requestValidationMode="2.0" />

    but visual studio tells me that the attribute  'requestValidationMode' is not allowed...

    Any idea how I can make this work? 

    Thanx, regards

    Tuesday, September 25, 2012 10:31 AM

Answers

  • User1958125286 posted

    In ASP.NET 4, by default, request validation is enabled for all requests, because it is enabled before the BeginRequest phase of an HTTP request. As a result, request validation applies to requests for all ASP.NET resources, not just .aspx page requests. This includes requests such as Web service calls and custom HTTP handlers. Request validation is also active when custom HTTP modules are reading the contents of an HTTP request.

    To revert to the behavior of the ASP.NET 2.0 request validation feature, add the following setting in the Web.config file:
    <system.web>
    <httpRuntime requestValidationMode="2.0" />
    </system.web>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 25, 2012 10:39 AM
  • User1958125286 posted

    Did you compile the solution code after editing the web.confg?

    Clean and then Rebuild the solution and then if you are still getting the error please do post the error here..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 25, 2012 11:43 AM

All replies

  • User1958125286 posted

    In ASP.NET 4, by default, request validation is enabled for all requests, because it is enabled before the BeginRequest phase of an HTTP request. As a result, request validation applies to requests for all ASP.NET resources, not just .aspx page requests. This includes requests such as Web service calls and custom HTTP handlers. Request validation is also active when custom HTTP modules are reading the contents of an HTTP request.

    To revert to the behavior of the ASP.NET 2.0 request validation feature, add the following setting in the Web.config file:
    <system.web>
    <httpRuntime requestValidationMode="2.0" />
    </system.web>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 25, 2012 10:39 AM
  • User-1522737762 posted

    That's what I did... VS always tells me that this attribute is not allowed... However I leave it, it still not working...

    it's driving me crazy...

    EDIT:

    Okay... I had to tell VS that my project was in 4.0(eventhought IIS was allready)

    Any way this didnt solve my issue, still have error 500 when the page making the request is called...

    Tuesday, September 25, 2012 10:43 AM
  • User1958125286 posted

    Did you compile the solution code after editing the web.confg?

    Clean and then Rebuild the solution and then if you are still getting the error please do post the error here..

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 25, 2012 11:43 AM
  • User-1522737762 posted

    All is working fine now...

    Wednesday, September 26, 2012 4:33 AM
  • User1097391149 posted

    i am having the same problem i compiled but didnt work

    Sunday, July 7, 2013 9:28 AM