newbie querystring question

M

middletree

OK, I'm not a newbie, but I have only used Get method, never used Post or
Session variables. I have used hidden fields to pass data from one page to
the next, and it has worked fine. However, I have a situation where I will
need to use querystrings in an Intranet app (to have a clickable link in an
email which will be sent).

So I posted a question about querystrings last week, and think I get it, but
I don't want to have to change my other ASP pages which could also direct
the user to this one page. So I was thinking about keep those pages the
same, and then putting this pseudo code in the targeted page:

If (querystring <> "" then
strVariablename = Request.querystring (whatever)
Else
strVariablename = Request.Form(whatever)
End if

So the page could be usable if it were

http://intranet/ShowAllInfo.asp

or

http://intranet/ShowAllInfo.asp?Ticket=111

Will such a mixed environment work?
 
R

Ray at

Yes, this CAN work. Just make sure you have your logic right. Like, what
if someone goes to showallinfo.asp?kajsdlfkjasljfa? The querystring <> ""
then, but there is no value for the value you're looking for.

Also, you could consider using Request.ServerVariables("REQUEST_METHOD") to
aid your page in deciding where it should define its data from.

Ray at work
 
M

middletree

Thanks. I'll have to look into both suggestions. Need to research the second
one, as I've never seen that before.
 
R

Robert May

What you've stated will work, but you might try the following:

value=Request("variableName")

You do get a penalty for this because it needs to search through basically
all of the collections in the Request object to find the variable name, but
in practice, it's never been a problem.

Robert
 
A

Adrienne

What you've stated will work, but you might try the following:

value=Request("variableName")

You do get a penalty for this because it needs to search through
basically all of the collections in the Request object to find the
variable name, but in practice, it's never been a problem.

You'll run into problems if it's one of the ServerVariables, like URL.
<input type="text" name="url" id="url" value="<%=request("url")%>" /> will
return the name of the page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top