How to send variable to another page asp.net

There are several methods to send variable to another page asp.net. Among those methods, one or more may be the right way. People to people differs the right way. For solving the problem, you can use any method. It is found that there are mainly 4 methods and you can use any method what you like. Before discussion of the methods, you should know one way is to place the value into some form of temporary storage: Cookie, Session, etc. And then redirect. In an ASP.NET Web Forms request, if you send from one ASP.NET Web Forms page to different page, you will regularly want to send information from the source or basic page to the marked page. Such as, you might have a source page where buyers can choice items to buy. When users submit the page, you want to call additional page that can start process the information that the user has received. It is possible to do by the visual basic. The application Visual Studio Web application project is available with the source code and you can download the source code from the link: http://go.microsoft.com/fwlink/?LinkId=214100.
You can send information between two pages in 4 ways, some of which based on how the redirection arises. The following selections are accessible even if the foundation page is in a diverse ASP.NET Web request from the target page, or if the source or the main page is not an ASP.NET Web Forms page: You should use a query string or Get HTTP POST information from the source page.
The following selections are accessible only when the basic and mark pages are in the same ASP.NET Web application. Select one from Use session state, create public properties in the source page and access the assets values in the target or goal page or get control information in the target page from controls in the source page.
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") %>

Here I use the POST method, the one I use most, its more confidential and doesn’t show the variable’s 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") %>

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

FILE : SENDING.ASP

<% name2 = "The name I want" 'or name2 = recordsetobject("name"). Yes you can get info from DB phone2 = "1232131221" %>


FILE : GETTING.ASP

<% gotname = request.querystring("name") gotphone = request.querystring("phone") %>

In the above approach you make a button, or an image. The image is hyperlinked so that the link contains the information you want to send.

The last example of passing data from one ASP page to another is through using session variables. Session variables can be very useful, they are similar to global variables. While you’re browsing between the pages the variable exists; you don’t have to explicitly pass it from one page to the next. Of course, there are disadvantages to using Session Variables. There is a nice article explaining the Pros & Cons of Session Variables on 4Guys.

FILE : SENDING.ASP

<% session("name") = "Myname" session("phone") = "21121231" %>



FILE : GETTING.ASP

<% gotname = session("name") gotphone = session("phone") %>

Those are the four ways with which you can pass data from one ASP page to another!