I am developing a web application. At the login page a user(taxpayer) keys in his username which is actually a tax identification number. I have a database of all registered taxpayers. Once the user logs in, I want his tax identification number to be displayed
on subsequent pages that he will visit(usually in asp textboxes where he is to provide such identification number again). I also want his name and other relevant information to be automatically loaded into any required text fields on each page where necessary.
you simply put that piece of information in the database and retrieve it when needed on subsequent pages. Or, if you want to keep it in memory for easy access you can also make use of
Session state. However note that you best not put too much information in Session state though so use it with care.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Marked as answer by Allen Li - MSFT on May 04, 2012 01:15 AM
Sparkles2012
Member
2 Points
4 Posts
Passing values between asp.net pages
Apr 28, 2012 08:00 PM|LINK
Hi
I am developing a web application. At the login page a user(taxpayer) keys in his username which is actually a tax identification number. I have a database of all registered taxpayers. Once the user logs in, I want his tax identification number to be displayed on subsequent pages that he will visit(usually in asp textboxes where he is to provide such identification number again). I also want his name and other relevant information to be automatically loaded into any required text fields on each page where necessary.
XIII
All-Star
182702 Points
23463 Posts
ASPInsiders
Moderator
MVP
Re: Passing values between asp.net pages
Apr 28, 2012 08:24 PM|LINK
Hi,
you simply put that piece of information in the database and retrieve it when needed on subsequent pages. Or, if you want to keep it in memory for easy access you can also make use of Session state. However note that you best not put too much information in Session state though so use it with care.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Allen Li - M...
Star
10411 Points
1196 Posts
Re: Passing values between asp.net pages
Apr 30, 2012 06:26 AM|LINK
Hi, you can try ASP.NET Profile:
http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
patuary
Member
425 Points
143 Posts
Re: Passing values between asp.net pages
Apr 30, 2012 06:51 AM|LINK
In your case I prefer to use Session. on session end event all information of user will be destroied automatically.
Pince
Member
52 Points
18 Posts
Re: Passing values between asp.net pages
Apr 30, 2012 10:11 AM|LINK
You can use Session to pass a value from one to another page, in your case create session and store all required values while the login like
Session["taxPayer"] = "Tax Payer Name";
And you can get the tax payer name from your needed page, like
string taxPayerName= Session["taxPayer"];
Finally close your seesion,
Session["taxPayer"] = null;
(OR)
Session.Abandon(); //Close all sessions