Home > Net > Asp.net how to use the Session between multiple pages by value to each other
Asp.net how to use the Session between multiple pages by value to each other
Time:04-20
In asp.net, designed a login page, a page and a page message board, want after logging in the user name to login to the home page and message boards on the Label of the navigation bar and click on the front page after page of Label still displays the current logged in user, which is as long as no matter how to switch after the login page can ensure the Label shows the current logged in user,
CodePudding user response:
Direct assignment, again is not good,,, The Session (" UserName ")="123456";
If (Session (" UserName ")!=null) { Label. The Text=Session (" UserName "). The ToString (); }