?
Solved

how can I send data from one asp to another asp

Posted on 2000-03-07
1
Medium Priority
?
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
damianosky earned 400 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

770 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