Solved

how can I send data from one asp to another asp

Posted on 2000-03-07
1
165 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 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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 …
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

726 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