About transferring session variables...

  • Thread starter Thread starter Hanumant Ganpat
  • Start date Start date
H

Hanumant Ganpat

I am working on webdevelopment using ASP.NET with C#. I am trying to
transfer page from one application to another application page.I have to
access session variables from last application into new transferred
page.How can I do?
If any one have any idea Please help me....!!
 
//Page1.aspx
Session["FirstName"] = FirstNameTextBox.Text;

//Page2.aspx
string firstName = Session["FirstName"].ToString();

--or--

//Page1.aspx
Session["NumberOfBitchyGirlfriends"] = 3;

//Page2.aspx
int bitchbitchbitch = (int)Session["NumberOfBitchyGirlfriends"];

NOTE: since you may --literally-- mean you want to transfer data from one
application to another we cannot use Application2 to access the Session
generated in Application1. If Application2 is in the same domain as
Application1 (mywebsite.com for example) we can then write a cookie in
Application1 to mywebsite.com that contains the Session variable and then
read the cookie from Application2 that also exists in the same domain
mywebsite.com; if not the same domain use the database or an XML file to
store the data as required.
 
Back
Top