I am very new to ASP.NET so please take that into consideration in your response.
I have a method that creates a session cookie for my username and User ID that works when I put it into the code behind (See below)
protected void Page_Load(object sender, EventArgs e)
{
if (Page.User.Identity.IsAuthenticated) // if the user is already logged in
{
MembershipUser currentUser = Membership.GetUser();
Guid CurrentUserID = (Guid)currentUser.ProviderUserKey;
string CurrentUsername = (string)currentUser.UserName;
Session["CurrentUserID"] = CurrentUserID;
Session["CurrentUserName"] = CurrentUsername;
}
else
{
Session["CurrentUserID"] = "";
Session["CurrentUserName"] = "";
}
}
I am trying to clean up my project ...
Go to the complete details ...