J
JC
Hi,
Thanks for reading...
I am authenticating users in a web app thus:
sqlCommand2.Parameters["@username"].Value = txtUserName.Text;
sqlConnection1.Open();
string userEmail = (string)sqlCommand2.ExecuteScalar();
sqlConnection1.Close();
Session.Add("userEmail",userEmail);
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUserName.Text,false);
The variable userEmail is being populated. However, when I later on
try to retrieve the session variable 'userEmail' using...
Response.Write(Session["userEmail"].ToString());
I get 'Object reference not set to an instance of an object' error.
Clearly I'm missing something - your advice would be appreciated.
Perhaps there is a better way to persist this information? Thanks for
your help.
Thanks for reading...
I am authenticating users in a web app thus:
sqlCommand2.Parameters["@username"].Value = txtUserName.Text;
sqlConnection1.Open();
string userEmail = (string)sqlCommand2.ExecuteScalar();
sqlConnection1.Close();
Session.Add("userEmail",userEmail);
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUserName.Text,false);
The variable userEmail is being populated. However, when I later on
try to retrieve the session variable 'userEmail' using...
Response.Write(Session["userEmail"].ToString());
I get 'Object reference not set to an instance of an object' error.
Clearly I'm missing something - your advice would be appreciated.
Perhaps there is a better way to persist this information? Thanks for
your help.