Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 must GET a POST in ASP

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-11 : 15:44:52
Calling all ASP programmers.

I'd like to transfer a long query string to another ASP page without using QUERYSTRING.

This works:
Response.Redirect "Mypage.asp?Mystring=" & strReallyToLong

Is there a technique in ASP to simulate a POST at execution time?

Sam

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-11 : 15:55:53
It sorta depends on your exact scenerio. Do you want the user to navigate to the second page, or do you want to do it behind the scences?

If you need the user to navigate to the page in question, you could do some javascript magic. Instead of response.redirect, do some response.writes of a HTML form that has a hidden form field that contains your string. Then, you response.write out some javascript that submits the form on page load. I can help you with that code if needed. I've done it all before.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-11 : 16:02:32
No User. No navigation.

I've calculated a long sql querystring, I want to pass it to a report page without flying it in the wind for everyone to see as a querystring variable.

A hidden field is a little better, but what I ought to do is rewrite the page to embed the reporting so passing a query becomes unneeded.

Sam
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-11 : 17:10:42
I'm not exactly sure what you have, but it sounds likes frames might be another solution for you. I think all of my reporting is done in frames. I have a lower frame that displays the outputted PDF, and my top frame handles "navigation" back to the rest of the site, or back to change the report parameters. All the user see's is that they are on reports.asp or whatever.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-11-11 : 17:44:29
Sounds like an architechture prob..(Sorry Sam)
Why are you building your SQL on a different page ? Why not build the string on the page it needs to be executed on ?



Damian
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-11 : 18:36:37
Yeppers. It sounded like a good idea at the time. Now it smells like a dead racoon.

I'll have to switcheroo back to doing page visibile stuff to fix this one.

Sam
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-11-11 : 18:52:31
If it's smaller than 4k you could whack it in a cookie. Or in a session var (clear it as soon as you can).



Damian
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-11 : 19:37:12
I'm on record for prior cookie whacking. Can't risk parol violation. But the session var is an excellent candidate.

If it's too tough to integrate it into the current page, the session var will do the trick.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-11 : 19:39:06
Session sounds like the best place for this thing. Gets around the cookie and javascript issues.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-11-12 : 14:29:00
it's easy:

set up a form. set the method=post, and set the action, and be sure to give the form an ID.

Include on the form as many hidden input fields as you need.

so, you might have:

<form id=myform method=post action=somepage.asp>
<input type=hidden id=val1 name=val1>
<input type=hidden id=val2 name=val2>
</form>

then, when you are ready to submit:

1) use VBScript or javascript to set myform.val1.value=whatever and myform.val2.value=whatever and so on.

2) execute the submit method of the the form. i.e., in this case, you'd execute "myform.submit()"

So, in ASP, just have the script build the form and the fields, and have the script execute immediately.

- Jeff
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-11-12 : 15:02:32
[code]
<%StrSQL = "SELECT * FROM Table WHERE Blah Blah Blah" %>

<html>
<head>
<title>SQL PassThrough Page</title>
</head>

<!--page will perform all ASP processing and then post the form-->

<body onLoad="document.forms(0).submit()" >
<form action="SQLProcessPage.asp" method="post" name="frmBuildSQL">
<input TYPE="hidden" VALUE="<%=strSQL%>" NAME="SQL">
</form>
</body>
</html>
[/code]
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-11-12 : 16:47:15
exactly !

- Jeff
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-12 : 20:17:43
[code]
<%
Dim oDeadHorse

SET oDeadHorse = Server.CreateObject("Horse.DeadHorse")

While 1 = 1
oDeadHorse.Beat()
Next
%>
[/code]

Ok, we've solved this problem about 3 ways now. I think Sam just has to pick one and go with it!

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -