When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Senior Developer (.NET)
Professional Technical Resources
US-CA-Santa Cruz

Justtechjobs.com Post A Job | Post A Resume

Passing Variables Between ASP Pages using POST


The previous FAQ described how to pass information from one page to another using the QueryString. To assimilate variables in the QueryString you can either use a form with METHOD="GET" or redirect the user to a URL which looks like:

http://www.myserver.com/myasp.asp?var1=hello&var2=world

You can also pass variables using the form METHOD="POST". This has the effect of "hiding" the parameters passed, since it is done on the server-side as opposed to having the client pass the information string to the server (as in the QueryString example above).

A POSTed form looks identical to a GETed form, except instead of FORM="GET", we put FORM="POST". Here is an example:

<FORM METHOD="POST" ACTION="myasp.asp">
      ... HTML here ...
</FORM>

In the file myasp.asp, we read the data the same way we do for QueryString variables. We just use Request(variablename). For more information on how to read variables using Request, please read the previous FAQ.

You may be wondering why anyone would prefer using a GET over a POST or vice versa. They appear to be identicle. One benefit of a POST is that you can pass nonstandard characters with less hassle than through the QueryString. For example, say that you wanted to pass the string: "Hello     my name is ?&!" Well, passing characters like ?, &, and " " can be cumbersome through the QueryString. When variables will hold such characters, it is often wiser to put them in a POSTed FORM as opposed to a GETed one.

Also, in some older browsers there is a limit to the length of the QueryString. If you need to pass a lot of variables, be sure to not do it through the QueryString.

FAQ Table of Contents   Passing Variables Between ASP Pages Using Option Explicit 


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers