user1157982
user1157982

Reputation: 51

Max querystring length on asp .net 2.0

I am working on ASP .NET version 2.0 and IIS 6. I am calling a pop up aspx page from the main page by calling its URL and passing querystring to it. For a specific case the length of my querystring exceeds more than 2000 characters. So the pop up screen opens up fine for the first time but whenever there is a postback in that pop up screen, I get a internet connection error. I am sure this is happening because of the large length of the querystring because it works fine when I reduce the length of querystring.

Is there a way we can increase the maximum allowed length of the querystring passed. Can it be configured through web.config or in some IIS settings.

Upvotes: 5

Views: 18202

Answers (3)

LCJ
LCJ

Reputation: 22652

Following is the approach I use for ASP.Net MVC 4

<system.web>

    <httpRuntime maxQueryStringLength="6000" />

  </system.web>

  <system.webServer>

        <security>

            <requestFiltering>
                <!--Query String Length-->
                <requestLimits maxQueryString="6000" />
            </requestFiltering>         
        </security>

  </system.webServer>

REFERENCE

  1. request exceeds the configured maxQueryStringLength when using [Authorize]
  2. WCF says it exceeds maximum query string value while it is not

Upvotes: 5

wałdis iljuczonok
wałdis iljuczonok

Reputation: 662

Attribute maxQueryStringLength of httpRuntime element is supported only by 4.0 and above. You have to use IIS settings to control max query string limits.

http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits

Upvotes: 3

Amar Palsapure
Amar Palsapure

Reputation: 9680

By default it 2048. Check this post (MSDN). Set maxQueryStringLength in httpRuntime section of your web.config.

Please check the requirements for this on the same post.

Hope this works for you.

Upvotes: 4

Related Questions