0
我在VS2005中使用了一个小应用程序。我使用visual studio提供的登录控件创建了一个登录面板。如何使用FormsAuthentication在默认页面上重定向页面?
我为此使用了表单验证。它的工作正常。现在我想使用表单身份验证在链接按钮上创建注销功能。
我该如何实现此功能? 请提供宝贵的回复。
我在VS2005中使用了一个小应用程序。我使用visual studio提供的登录控件创建了一个登录面板。如何使用FormsAuthentication在默认页面上重定向页面?
我为此使用了表单验证。它的工作正常。现在我想使用表单身份验证在链接按钮上创建注销功能。
我该如何实现此功能? 请提供宝贵的回复。
您注销链接按钮的代码记录中应该何时实施:
//sign out from form authentication
FormsAuthentication.SignOut();
//abandon session
Session.Abandon();
Response.Redirect("logon.aspx");
你可以在以下链接找到更多的细节。 Log-Out using form Authentication
这些东西应该OUT-
FormsAuthentication.SignOut(); //Removes the forms-authentication ticket from the browser.
Session.Clear(); //clear all session values
Session.Abandon(); //Remove session objects
FormsAuthentication.RedirectToLoginPage(); //redirect the user back to the login page
//OR
Response.Redirect("/Default.aspx"); //whichever page you need.
我想为FormsAuthentication.RedirectToLoginPage()设置默认页面。它的重定向到login.aspx,但我没有login.aspx页面。我如何设置? –
我在默认页面上创建了登录面板。 –
更新了答案.. – Cdeez