Solved

how can I send data from one asp to another asp

Posted on 2000-03-07
1
157 Views
Last Modified: 2013-12-24
how can I send data from one asp to another asp. example I retrieved my data from the first asp. I wanted the data to be send to another asp.  How do I do calculation in this data field example addition, deletion or multiplication.

Thanks
0
Comment
Question by:da511
1 Comment
 
LVL 1

Accepted Solution

by:
damianosky earned 100 total points
ID: 2600624
There are two methods to pass data
from one asp to the other

1) you can use the "get" method for passing values from a page to the other.

Simplifying, if you want to pass two values, e.g. 2 and "test", from  the "first.asp" to the page "second.asp", the sintax to use in the call is:

"second.asp?v1=2&v2=test"

In your firsta.asp load two variables like this:

value1 = 2
value2 = "test"

Then your code can be or an Hyperlink like this;

<a href="second.asp?v1=<% =value1 %>&amp;v2=<% =value2 %>">Your comment</a>      

if you want data passed after user choosing of a link (this is good for multiple options).

On the other hand, you can also use a redirect like this (e.g. after a your processing of the data in the first.asp)

response.redirect "second.asp?v1=" & value1 & "&amp;v2=" & value2

(supposing the two pages are in the same directory; otherwise, use relative location).

After that, in the page "second.asp" you must specify the asp code as follow:

<%
value1 = request.querystring("v1")
value2 = request.querystring("v2")

.....
%>

so you retrieve the values passed from the other page and you can use them from  asp to know what is the selected item and dynamically set the output.

This is an example for two values, but you can extend to more values...

Be aware that "get" method of posting data do not allow more than 2000 characters lenght to be passed. So, use it with parsimony (especially for the names you use: v1 and v2 have to be preferred to value1, value2 and so on...)

2) a second method is to use session variables: you can load the two (or more values) in session variables in the fisrt.asp like this:

Session("value1") = 2
Session("value2") = "test"

To retrieve this values in the second.asp, you can use:

val1 = Session("value1")
val2 = Session("value2")

Keep in mind that session variables have a time life (you can set this by the command:

Session.TimeOut = xx

where xx are minutes (default value depends on server configuration).

Moreover, session variables are stored on server side, so they are server memory consuming. If you have to store too many data, you can fill out server memory. And Microsoft suggest to not use them on Windows 2000 servers network, because they are not compatible with NLB (network load balancing). It's too long to explain why here, so i suggest you to refer to Microsoft Web Site.

Apart of these limitations, session variables, if correctly used, are very useful: your data are available for more pages - not only for the second.asp, as it happens with the first method - until timeout occours (but you have a timeout if user does not use the browser for more of the time limit or he closes it!)
or you change the variables' content, e.g.:

' *** new value ***
Session("value1") = 3

To retrieve the values stored in session variables the sintax is always the same for any page of your site.


A possible third method is to use cookies. It's the more difficult to use (on my opinion), and you have to consider that some users can disable cookies for security reason. I've have never used, until today, cookies in my asp applications, except for persistent cookies to count user's access or preferences (but for the last one you can use also a database on server side).





0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now