I am having a problem with the code below. I simply want to go from a shopping cart page to a select credit card page, and redirect if not logged in. The problem is that even after login the cc page still can't catch the session user name, even though it is present on the login label.
I have attached the code that stores the session variable on the login page, and the if statement that redirects. I am not too familiar with c#, so it is probably something I am doing wrong... Thanks!
public partial class login : System.Web.UI.Page
protected void Login1_LoggedIn(object sender, EventArgs e)
//user is logged in, store username in a session variable
Session["userName"] = Login1.UserName;
//Get the userID of this user and store it in a session variable
MembershipUser usr = Membership.GetUser((string)Session["userName"]);
Session["userID"] = usr.ProviderUserKey;