Tuesday, November 8, 2011

Support for large URL's

We might encounter scenarios where the URL that we need to have is very large when developing applications. In such cases we need to do the below configurations in order to have large URL's:

In the web.config set the following:


<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime  maxUrlLength="2048" maxQueryStringLength="2048" maxRequestLength="2048" />
  </system.web>

Then find the registry setting for a URLSegmentLength and increase it to some value appropriate:

UrlSegmentMaxLength registry setting, increasing to 2048 (x800)

If the service is being hosted in IIS then also add the following to the webServer section in web.config:

<system.webServer>
      <security>
         <requestFiltering>
            <requestLimits maxUrl="a large value"/>              
         </requestFiltering>
      </security>
   </system.webServer>
 

That should be enough for you to have your URL's to be very large.

No comments: