473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

querystring length

I have an ASP page with a button and other things.
When the button is clicked, it executes a javascript function which does:

document.Form1.method = 'post';
document.Form1.action = "AnotherASPpage.asp?p1=" + allFields1 + "&p2=" +
allFields2 + "&p3=" + bVar;
document.Form1.submit();

allFields1 represents all the fields in category 1 that user has selected.
The fields are delimited by comma.
allFields2 represents all the fields in category 2 that user has selected.
The fields are delimited by comma.

The AnotherASPpage.asp is supposed to display the result in Excel spreadsheet.

I test it by selecting 15 fields in category 1 and it pops up a File
Download small window asking if I want to Open, Save, or Cancel the Excel
file. It shows an Excel name like abc.xls in the Name: section in that small
window. I can Save the file successfully.

But, when I select 16 fields in category 1, pops up a File Download small
window asking if I want to Open, Save, or Cancel the Excel file. But, it
doesn't show an Excel name like abc.xls in the Name: section in that small
window. It shows ..., id1%20AS%20... When I click Save, it gives error about
IE can't download ...&p3=...

It looks like the limit of the querystring in the URL is too long. But with
POST method the limit is huge and I'm no where near that limit.

I am thinking about using hidden variables to pass data from one page to
another but I can't because onclick of a button page1 invokes a javascript
function which submits AnotherASPpage.asp and thus doesn't know about the
hidden variables from page1.

Can someone please help? Thanks.

Aug 14 '08 #1
3 1909
displayname wrote:
I have an ASP page with a button and other things.
When the button is clicked, it executes a javascript function which
does:

document.Form1.method = 'post';
document.Form1.action = "AnotherASPpage.asp?p1=" + allFields1 +
"&p2=" + allFields2 + "&p3=" + bVar;
document.Form1.submit();

allFields1 represents all the fields in category 1 that user has
selected. The fields are delimited by comma.
allFields2 represents all the fields in category 2 that user has
selected. The fields are delimited by comma.

The AnotherASPpage.asp is supposed to display the result in Excel
spreadsheet.

I test it by selecting 15 fields in category 1 and it pops up a File
Download small window asking if I want to Open, Save, or Cancel the
Excel file. It shows an Excel name like abc.xls in the Name: section
in that small window. I can Save the file successfully.

But, when I select 16 fields in category 1, pops up a File Download
small window asking if I want to Open, Save, or Cancel the Excel
file. But, it doesn't show an Excel name like abc.xls in the Name:
section in that small window. It shows ..., id1%20AS%20... When I
click Save, it gives error about IE can't download ...&p3=...

It looks like the limit of the querystring in the URL is too long.
But with POST method the limit is huge and I'm no where near that
limit.

I am thinking about using hidden variables to pass data from one page
to another but I can't because onclick of a button page1 invokes a
javascript function which submits AnotherASPpage.asp and thus doesn't
know about the hidden variables from page1.
I don't understand the problem. In the form's onsubmit event, populate the
hidden elements with the required values. Forget about the querystring.

What's the problem?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 14 '08 #2


"Bob Barrows [MVP]" wrote:
I don't understand the problem. In the form's onsubmit event, populate the
hidden elements with the required values. Forget about the querystring.

What's the problem?
After user selects all the fields, there's need to have a way to tell the
program to query the data and display the result in Excel. The button is a
way to let the user do that.
Here's the sequence of events:
1) page1.asp is rendered
2) user selects some fields from page1 and click the button
3) can page1.asp sets some hidden variables to indicate which fields the
user has just selected at this point?
4) page1.asp redirects to AnotherASPpage which needs to know which fields
the user selected.
5) AnotherASPpage.asp queries the database for those selected fields and
displays the result in Excel.
6) user still sees page1.asp and doesn't see AnotherASPpage.asp at all.
Aug 14 '08 #3
Bob Barrows [MVP] wrote:
I don't understand the problem. In the form's onsubmit event,
populate the hidden elements with the required values. Forget
about the querystring.
What's the problem?
For one thing, hidden inputs can very much impact the length of the
querystring. The OP's red herring is setting the form method to "post",
while littering the action with name-value pairs. His script is, in effect,
reading the querystring.

The problem with using POST and returning an ASP document with ContentType =
"application/vnd.ms-excel" (or
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" if Excel
2007) is that Internet Explorer handles the response, determines that the
ContentType requires an external application, then hands over the URL (not
the response stream) to Excel. At this point, Excel knows nothing about the
original POST, and submits a new request with the querystring only. This can
be confirmed by reading the IIS logs.

Gecko Browsers have no such problem.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Aug 14 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
2
by: Marcin | last post by:
i want to pass XML data in querystring from one to another asp page. it is about 10000 characters long, i cannot use FORM because it is already nested in one. What i do is i have IFRAME and im...
4
by: Steve | last post by:
Hi All, This problem is really annoying me, as I am sure there is a simple solution to it. If I try to read a querystring value in the Page_Load event and that querystring does not exist I...
1
by: Mark | last post by:
Hello Can anyone tell me how to check if a a querystring is present or not I.E. If request.querystring("key") is in the url or not because when i try to reference it in anyway and its not...
4
by: Guoqi Zheng | last post by:
On my application, I need to have different action based on the pass in query string. When the query string is not presented, I try to use If request.querystring("id") ="" THEN ...... This is...
4
by: DaveF | last post by:
I am looping threw the querySting with: foreach (string name in Request.QueryString) I have a problem with a '&' being in one of the values. How do I deal with this? ...
3
by: hecsan07 | last post by:
I am a newbie in .NET. I am trying to collect the query string and paste it to the new url. The problem is I am not sure with the particular names of the query string elements are. How can I...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
0
by: sirjohnofthewest | last post by:
This function will give you 100% control over the QueryString -- perfect for programmers who use QueryString manipulation a lot. I wrote this function when I kept having to change values of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.