[英]ASP.NET HeadLoginView Logout Click. Logs out of other local websites too
我有2-3個Web項目(初學者)。 在所有網站中,我都有一個登錄控件,用戶可以在其中登錄。當用戶使用正確的信息登錄時,我設置了
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (CHUser.AunthencateLogin(Login1.UserName, Login1.Password))//Checks with database
e.Authenticated = true;
else
e.Authenticated = false;
}
到這里為止還可以,但是當我同時登錄2個單獨的網站(本地)並在其中任何一個網站注銷時,就會出現問題。 當我登出一個網站時,另一個網站也登出了(刷新時)。 以下是我注銷時使用的代碼。
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
Session.Clear(); //though logout works without this code. It is for other
//sessions that are manually created by me
}
我看不出是什么原因造成的。 我也是Web開發的新手。
我也想知道這是否是登錄用戶的正確方法。
(在問題編輯中回答。轉換為社區Wiki答案。請參見將問題的答案添加到問題本身時將采取什么適當的措施? )
OP寫道:
謝謝@Aristos。 通過在web.config 1st項目上使用以下代碼解決了問題
<authentication mode="Forms"> <forms name=".Cookie1" ... /> </authentication>
第二項目
<authentication mode="Forms"> <forms name=".Cookie2" ... /> </authentication>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.