Hi there,
I am trying to create a session based on a field from a datareader.
the code I have so far is
string sqlStmt = "Select Member_Username, MemberID from Members where Member_Username='" + UserName.Text + "' and Member_Password='" + PassWord.Text + "'";
SqlConnection sqlConn = new SqlConnection("server=********;");
SqlCommand sqlCmd = new SqlCommand(sqlStmt, sqlConn);
sqlCmd.Connection.Open();
SqlDataReader sqlReader = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
Session["username"]=UserName.Text;
if (sqlReader.Read())
FormsAuthentication.RedirectFromLoginPage(UserName.Text, true);
else
LtlLogin.Text = "Invalid Login";
The session I need to create is the MemberID.
Any ideas?