We have an ASP .NET 4.0 application. We transfer data between pages through query strings. In one case we are moving a large data to the next page which is around 7000 characters. We were getting query string length error. Then we tried increasing the maxquerystring length in Web.config. Now it is not throwing any error, but IE reduces the URL to 2k and opens the page. The full query data is not passed to the page. Is there any option to increase IE URL length?
Asked
Active
Viewed 737 times
0
-
Bad design. Better find some other way to transfer your data. – Aristos Dec 26 '13 at 15:44
-
I agree with @Aristos There is also a maximum length of querystring which varies across browsers - see http://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string Can you not use database or even session state to persist your data? – geedubb Dec 26 '13 at 15:47
-
Please Post the data instead of QueryString or use server.transfer method – Manoj Mevada Dec 26 '13 at 15:55
-
yes, we know it is not the best idea. But we cant use session. bcoz there will be multiple windows open. We cant really hit database everytime. Is there any other option to move data to next page? – sabaedge Dec 26 '13 at 15:58
-
@ManojMevada Server.transfer is not possible. please tell me how to post the data. – sabaedge Dec 26 '13 at 15:59
-
1Dead end, the query string limit is built into the browser itself. You must refactor the code and not pass data on the querystring. There are tons of alternatives, most "failsafe" being storing all data in database and passing only unique user/visitor ID on the querystring or a cookie. – Shadow The GPT Wizard Dec 26 '13 at 16:23
-
@sabaedge if you post your current code that pass the data between pages maybe someone can help you refactor it. – Shadow The GPT Wizard Dec 26 '13 at 16:27
-
@ShadowWizard: can u please tell any other option? – sabaedge Dec 26 '13 at 16:30
-
@sabaedge well, if your current mechanism is plain links like `next` then it's easy enough to make it work even with 7000 characters using jQuery trick I have in mind. That's why I asked you to post your code. – Shadow The GPT Wizard Dec 26 '13 at 18:32
2 Answers
3
Please try this:
Create a hidden variable and get this hidden variable through Request["Variable Name"]
<input type=hidden name="Test" value="99" /> In ASPX Page
string xyx=Request.Form["test"].ToString(); - Code Behind
Here is example: I have created two pages 1. Default.aspx and WebForm1.aspx. Please refer attached images:

Manoj Mevada
- 649
- 4
- 7
0
Just spitballing - in your comments, you don't want to POST, nor db, nor (server) session, I think it's (been made) clear that querystring
approach isn't/wasn't the way to go, then depending on your needs/requirements/audience, perhaps look into DOM/web/local storage...
Hth...

EdSF
- 11,753
- 6
- 42
- 83