c# - Unable to display contents of Session to ASPX page -
c# - Unable to display contents of Session to ASPX page -
so have piece of code which, when user logs in, take username , set session, called username. (for sake of simplicity i've set test string in there useremail.username)
else { session["username"] = "test"; response.redirect("default.aspx"); }
as far can tell, chunk of code works, 1 time user logs in redirected default.aspx. have piece of code (in master page's code behind on page_load) makes 1 panel visible if session not null, works, meaning there stored in session:
if (session["username"] != null) { pnlloggedin.visible = visible; }
however when seek display in front end of text:
<h3>welcome <h3>
so "welcome [username]" can't. don't know code. i've tried creating public string called getusername , calling that, i've tried putting session["username"] in front end prints out that, code i'm looking here?
try using:
<h3>welcome <%= server.htmlencode((string)session["username"]) %><h3>
c# asp.net string session
Comments
Post a Comment