Hi, I am using a custom membershipProvider I have developed. Now I need to understand what would be the best approach for logging out. I wrote the code below in the Page_Load of my login.aspx:
if (Context.User.Identity.IsAuthenticated){FormsAuthentication.SignOut();
Session.Abandon();
Session.Clear();}
but I dont know if that is the best way to follow. Besides, I dont know the best way to hinder not authenticated users to type directly on the browser the mainPage.aspx and getting access to it...maybe I could put a code in Page_Load of mainPage.aspx, to test if user is authenticated, directing it to Login page if not. The code might be something like below:
if (!Context.User.Identity.IsAuthenticated)
response.redirect("login.aspx");
What do u guys think about it???
Thanks a lot!!!!!
We are here to learn, and teach whenever possible...