Different ways to pass values between ASP.NET web pages
If you redirects from one ASP.NET web page to another, you might need to access information from source page to target page. There are different ways you can pass information between web pages.
Following are two ways to pass information if source page and target page in different web application or source page is NOT an ASP.NET web page.
- HTTP GET (through querystring)
- HTTP Post (passing information in HTTP header)
For more detailed information about HTTP GET and HTTP POST, please visit this link
Following options are available if both source page and target page are in same ASP.NET web application
1) Session State
Session state is an ASP.NET object that takes server memory and only available in current session.
In source page you can store information in session as shown in following example.
Session(“Variable”) = “SomeValue”
In targe page you can retreive information through session like this,
Dim valueFromSourcePage as string = Ctype(Session(“Variable”),string)
There are different ways you can tell server where to allocate memory to store session state object. That is entirely different topic and if you are interested to get some more knowledge you can visit this link.
2) Cross-Page Posting
Using PostBackURL property or Server.Transfer I will post another article shortly to explains both techniques in details.
If you have any question, please leave comment here.