Click to See Complete Forum and Search --> : problem in signout using forms authentication


prakashkyadas
November 4th, 2005, 12:14 PM
hello,

i am using forms authentication in developing a web site. it is working perfectly until forcing the user to login the site if they want to view the restricted web pages. but, the problem is coming when i am saying signout.
i pressed the signout buttons. it is going to the login page. when we type the url of the restricted page in the address bar it is going directly to the page without forcing the user to register to login.

i had written the sign out code as follows:
----------------------------------------
FormsAuthentication.SignOut();
Response.Redirect("xxxx.aspx");


pls reply me as soon as possible i need this very urgently.
bye.
prakash.

mmetzger
November 4th, 2005, 12:20 PM
Are you using a cookie (ie, is the authentication supposed to last across browser sessions?) Here's a copy of everything we do with our FormsAuthentication SignOut...


// If you have any cookies, make sure to expire them
string cookieName = FormsAuthentication.FormsCookieName;

Context.Request.Cookies[cookieName].Value = null;
Context.Request.Cookies[cookieName].Expires = new System.DateTime(1999,1,1);
Context.Request.Cookies[cookieName].Path = "/";

FormsAuthentication.SignOut();
Response.Cache.SetExpires(new System.DateTime(1996, 1, 1, 1, 1, 1));
Response.RedirectLocation = ConfigurationSettings.AppSettings["Homepage"].ToString();
Response.Redirect(ConfigurationSettings.AppSettings["Homepage"].ToString());

aquafin
November 9th, 2005, 12:37 AM
i have the same problem, when i press the signout button. it is going to the login page and when I type the url of the restricted page in the address bar it is going directly to the page without forcing the user to register to login. I have tried to clear the cookies , but , still i am able to access the restricted page, could any one help me??

aquafin
November 9th, 2005, 09:43 PM
prakash ,
this article should solve the problem,

http://aspalliance.com/694