Thursday, September 02, 2010

Unlimited Query string - ASP.NET

Introduction
Query string is one of the primary parameter passing techniques for Web Application.
Query string has some limitation in terms of query string length; this length depends on the browser.
Opera supports ~4050 characters.
IE 4.0+ supports exactly 2083 characters.
Netscape 3 -> 4.78 supports up to 8192 characters.
Netscape 6 supports ~2000
[http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html]
To handle the query string length limitation, there are few solutions –
using POST instead of GET,
passing by Cookies
Sending query string to the server by AJAX and adding to the session in the first step and fetching the query string from the session using some GUID concepts.
Here I am going to explain a best and stable solution for all the cases.
Background
We have three situations when we need to pass query string to the web page.
Opening a new window (http://msdn.microsoft.com/en-us/library/ms536651(VS.85).aspx)
Showing modal dialog (http://msdn.microsoft.com/en-us/library/ms536759(VS.85).aspx)
Showing the URL in iFrame (http://msdn.microsoft.com/en-us/library/ms537627(v=VS.85).aspx)
Request Maximum Size can be configured on IIS Server configuration for Server side.
http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
[ Thanks : daveauld - http://www.codeproject.com/Members/daveauld  ]
Read more: Codeproject