Answered by:
Length of Query string

Question
-
User-534300708 posted
Hi,
Am developing a web application where in search page I have 5 checked list boxes. When user selects multiple check boxes from these list boxes and clicks on search button. The result is displayed in Grid view with link button. When user clicks on link button of any item, then page is navigated to item details page and this entire search criteria(selected values in list boxes) is stored in query string. In details page I read this query string and fill other details. This works fine for most of the items.
But when user selects 'ALL' items in this list boxes, all the texts in the list boxes are added to query string and it gets larger than 2100 characters. At this time application returns ' file not found' error.
I need the selected check boxes items in search criteria in the details page.
Can you please suggest a better way for doing this ?
Sunday, November 5, 2017 4:23 PM
Answers
-
User2103319870 posted
Can you please suggest a better way for doing thisUsing Session
An Easy solution is to use session and it will be like this
Your PageA.aspx
//Set the value of Textbox to session Session["Data"] = YourcheckboxlistSeletedItems; //Perform your Redirect Response.Redirect("YourPageB.aspx");
YourPageB.aspx(Receiver Page)
You can read values from session like given below
if (!String.IsNullOrEmpty(Session["Data"].ToString())) { //Read values from session string valueA = Session["Data"].ToString(); }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, November 5, 2017 4:28 PM
All replies
-
User2103319870 posted
Can you please suggest a better way for doing thisUsing Session
An Easy solution is to use session and it will be like this
Your PageA.aspx
//Set the value of Textbox to session Session["Data"] = YourcheckboxlistSeletedItems; //Perform your Redirect Response.Redirect("YourPageB.aspx");
YourPageB.aspx(Receiver Page)
You can read values from session like given below
if (!String.IsNullOrEmpty(Session["Data"].ToString())) { //Read values from session string valueA = Session["Data"].ToString(); }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, November 5, 2017 4:28 PM -
User347430248 posted
Hi Chait,
there is no any maximum limit mentioned for the query String.
but there is a limit of length of URL in browser.
every browser has different limit of characters it can handle .
Microsoft Internet Explorer (Browser)
Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.
Firefox (Browser)
After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.
Safari (Browser)
At least 80,000 characters will work. I stopped testing after 80,000 characters.
Opera (Browser)
At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.
Apache (Server)
My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.
Reference:
What is the maximum possible length of a query string?
What is the maximum length of a URL?
and generally it returns error below.
but I can see that you are getting " file not found" error.
are you trying to open any file in your code?
you did not posted the code so we are not sure about it.
if you are opening any file then try to post your code.
it will help us to find the issue in your code.
Regards
Deepak
Monday, November 6, 2017 1:11 AM -
User-534300708 posted
Thanks for the reply.
Am not trying to open any file just navigating to page and displaying the values based on the query string. Until the query string length is 2106 characters page is displayed perfectly. For the example at one scenario the length of query string is 4101 characters. The error message is
"404-File or directory not found
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. "
Monday, November 6, 2017 5:13 AM