PDA

View Full Version : سوال: خروج كاربر از سايت با ممبرشيپ



s_mokhtari
شنبه 06 شهریور 1389, 18:19 عصر
با سلام
دوستان براي خروج يه لينك باتن گذاشتم اين كدي كه داخل سايت پيدا كردم


Response.Cache.SetNoStore();
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
Response.Cache.SetCacheability(HttpCacheability.No Cache);
System.Web.Security.FormsAuthentication.SignOut();
System.Web.Security.Roles.DeleteCookie();
Session.Clear();
System.Web.Security.FormsAuthentication.RedirectTo LoginPage();


RedirectToLoginPage(); اين چه صفحه‌اي كه بايد تنظيم كنم
بايد توي كنترل لوگين تنظيم انجام بدم
ممنون:چشمک:

raziee
شنبه 06 شهریور 1389, 22:20 عصر
http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.as px

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Security" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

Public Sub LoginLink_OnClick(sender As Object, args As EventArgs)
FormsAuthentication.SignOut()
FormsAuthentication.RedirectToLoginPage()
End Sub

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>

<form id="form1" runat="server">
Welcome <b><%=User.Identity.Name%></b>. Not <b><%=User.Identity.Name%></b>?
Click <asp:LinkButton id="LoginLink" Text="here"
OnClick="LoginLink_OnClick" runat="server" />
to sign in.

<!-- Page Contents -->

</form>



</body>
</html>

RedirectToLoginPage(); اين چه صفحه‌اي كه بايد تنظيم كنم
بايد توي كنترل لوگين تنظيم انجام بدم
برگشت به صفحه ورود هست.
این صفحه رو در وب کانفیگ باید معرفی کنی.
<authentication>
<forms loginUrl="login.aspx"></forms>
</authentication>