> How do I pass a variable from one webpage to another in C# ?
I have created a UserLogin page which wants to pass the value of
UserName to
another page called UserPage.
The easy way would be to use the Session object, which stores data for a
single user session. You could store the login user like this:
Session["UserName"] = "Andrew";
And you can retrieve it (in UserPage) like this:
string sUserName = Convert.ToString( Session["UserName"] );
Both lines may throw an exception if sessions are not enabled, or if the
variable wasn't set.
Greetings,
Wessel