Servers4 Ways to send/get Information from an ASP/HTML to another ASP

4 Ways to send/get Information from an ASP/HTML to another ASP

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




Joco Vieira

This one I think it will help many people , it was one of my biggest problems
when I started some more advanced web programming a couple of years ago.
What I am showing here is many ways to send the variables name and phone
from one HTML/ASP to an ASP.

This one I think it will help many people , it was one of my biggest problems when I started some more advanced web programming a couple of years ago. What I am showing here is many ways to send the variables name and phone from one HTML/ASP to an ASP.


1. Well like I said the variables are ‘name’ and ‘phone’, of course you
can use any variable you like.
     At this first example we use the GET method,
this one will show all the information on the link address,
    like”http://www.anything.com/getting.asp?name=thenamewritten&phone=phonewritten

FILE : SENDING.HTML

Name :

Phone:

 

FILE :
GETTING.ASP

        ‘ the querystring
gets the info that it is attached at the link address
        gotname = Request.querystring(“name”)

        gotphone = Request.querystring(“phone”)


2.
Here I use the POST method, the one I use most, its more
confidencial
and doesn’t show the variables content.

FILE : SENDING.HTML

Name :

Phone:

 

FILE :
GETTING.ASP



        ‘ the request.form gets the
info within the boxes of the form actioned
        ‘ from the previous HTML/ASP
        gotname = Request.form(“name”)

        gotphone = Request.form(“phone”)

%>

3. Here i use something like the first
example, the big difference is that you say wich variables to
send.

FILE : SENDING.ASP


    name2 = “Thename I want”
    ‘or name2 = recordsetobject(“name”) yes you can get
info from DB
    ‘ or make Calculations before
   phone2 = “1232131221”

%>

  <a href="getting.asp?name=&phone=” target=”_self”>

FILE : GETTING.ASP


        gotname = request.querystring(“name”)
        gotphone = request.querystring(“phone”)

%>

 

4. This way you make a button, or an image
that the HREF is the link with the info you want to send. I use some
predefined information
as two variables, such as name and phone,
remember this two variables can be first taken from an DB and then used to
href.
I use here the session argument, it is very usefull to its
purpose, its something like the global variables of the ASP pages, you
create one,
and while your browsing between the pages the variable
exists, or even reloading the same page.

FILE :
SENDING.ASP


    session(“name”) = “Myname”
    session(“phone”) = “21121231”

%>

FILE : GETTING.ASP


        gotname = session(“name”)
        gotphone = session(“phone”)

%>

 

And thats All 4 ways for you to trade information between
ASPs.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories