c# - Why is my ASP.NET Web Page not Getting or Setting my Session Variable? -
i've added bits of debug code in attempt figure out going on session variable, , appears empty.
could tell me doing wrong?
this noobie mistake, because don't web development.
private const string password = "password"; protected void page_load(object sender, eventargs e) { if (string.isnullorempty(password)) { lblmessage.text = !ispostback ? "not postback!" : "a postback."; } else { showdata(ispostback); } } private string password { { return session[password] string; } set { session[password] = value; } } protected void password_click(object sender, eventargs e) { string val = txtpassword.text.trim(); if (val == configurationmanager.connectionstrings[password].connectionstring) { password = val; txtpassword.text = null; } else { response.redirect(val); } } private void showdata(bool posttype) { // display data here if ever got point! }
edit: when password_click
event fires, ever see "not postback!" or "a postback." so, session variable must not getting set.
unless have disabled sessionstate (which don't think did), code looks ok.
the thing can think of method password_click
doesn't called.
please put breakpoint there , see whether variable gets set. if not show asp.net markup can see why it's not firing event
Comments
Post a Comment