Session value in asp.net
In my database I have to tables with Fname,Lname,Email,One is registration and one is for creating profile.Once the user registered successfully then the the page should be redirect to the creating profile page with the data of Fname,Lname and Email.so can any one help how to write the code??for getting the data I created session and am assigning into creating profile page but some thing is going wrong so that's why am not getting data.

Khargesh RajputRank #616 · 3.9K reputationPosted Feb 26, 2015, 6:52 PM EST
on register button after success
response.Redirect("profile.aspx?fname='"+txtfname.text+"'&lname='"+txtlname.text+"'&email='"+txtemail.tex+"'");
and on profile.aspx pageload
if(request.querystring["fname"]!=null)
{
lblfname.text=request.querystring["fname"].tostring();
//same for lname and email here
// do not use secure data such as password in querystring because querystring display in url text
}
and if you want session then on register page
session["email"]=textemail.text;
and on page where you want to retrieve session
lblemail.text=session["email"].tostring();
Priya Avanigadda46 reputationPosted Feb 26, 2015, 7:11 PM EST
Khargesh RajputRank #616 · 3.9K reputationPosted Feb 26, 2015, 7:20 PM EST
use like
on register page
session["email"]=textemail.text;// same for fistrname and lastname if necessry
response.redirect("profile.aspx");
and on page where you want to retrieve session
if(session["email"]!=null)
{
lblemail.text=session["email"].tostring();
}
Priya Avanigadda46 reputationPosted Feb 26, 2015, 7:27 PM EST
Khargesh RajputRank #616 · 3.9K reputationPosted Feb 26, 2015, 7:31 PM EST
can you share your code
Priya Avanigadda46 reputationPosted Feb 26, 2015, 7:39 PM EST
Rahul BansalRank #143 · 15.9K reputationPosted Feb 26, 2015, 7:45 PM EST
session["key1"]="value1";
session["key2"]="value2";
session["key3"]="value3";
after that redirect the page to 2nd page.
Response.redirect("2ndpage.aspx");
and check all or needed sessions on page_load event of 2ndpage.aspx like
if(session["key1"]!=null && session["key2"]!=null && session["key2"]!=null)
{
//use the value of session like session["key1"].ToString()
}
else
//go to error page
Rahul BansalRank #143 · 15.9K reputationPosted Feb 26, 2015, 7:48 PM EST
Session.Abondon().