If you think that this site is helpful, please recommend your friends to visit our site.
How to pass data in asp?
There are usually four ways to pass data in asp. They are pass variable through web form, pass data through cookie, pass information using session variable, and pass variable through querystring. The following is the code for passing variable in asp by using the above four methods:
1. Pass data through web form.
--------------------------------------------------------------------------------
Sending < form name="test" method="POST" action="test.asp" > Name:< br > < input name="name" size="18" > < br > < input type="submit" value="Send" name="Send" > < /form > Getting < % FormName = Request.form("name") % > -------------------------------------------------------------------------------- 2. Pass variable through cookie. -------------------------------------------------------------------------------- Sending < % Response.buffer = True name = Request.Form("name") Response.Cookies("name") = name % > Getting < % name = Request.Cookies("name") Response.Write (name) % > -------------------------------------------------------------------------------- 3. Pass data through session variable. -------------------------------------------------------------------------------- Sending < % session("name") = "Tom" % > < a href="test.asp" > < img src="test.gif" name="image" > < /a > Getting < % sName = session("name") % > -------------------------------------------------------------------------------- 4. Pass data through querystring. -------------------------------------------------------------------------------- Sending < % name = "Tom" % > < a href="test.asp?name=< % =name % >" > < img src="test.gif" name="image" > < /a > Getting < % qName = request.querystring("name") % >
No comments:
Post a Comment