私はAsp.Net MVC 3アプリケーションで作業しているので、私のアプリケーションでを使用しました。セッションとフォーム認証の問題:Asp.Net MVC 3
問題は、システムにログインした後、ブラウザを閉じて(ログアウトせずに)ブラウザでページを開いたとき(/Admin/ProductList/
と言う)、page is still being invoked
とI got focus in my controller too
です。 [それは本当に悪いです! :(]私が欲しいもの
は、私は、ブラウザを閉じて、任意のページに再び戻ってきたときに、それが必要logged in page
に行く、である。
をご理解の与えられたコードを確認してください。
public void SignIn(string userName, bool isCookiePersistent)
{
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddDays(14),
createPersistentCookie, string.Empty);
HttpCookie authCookie = FormsAuthentication.GetAuthCookie(userName, isCookiePersistent);
if (authTicket.IsPersistent)
{
authCookie.Expires = authTicket.Expiration;
}
authCookie.Value = FormsAuthentication.Encrypt(authTicket);
HttpContext.Current.Response.Cookies.Add(authCookie);
}
public void SignOut()
{
FormsAuthentication.SignOut();
}
のWeb.Configコード:
<authentication mode="Forms">
<forms loginUrl="~/Admin/Login" timeout="2880" />
</authentication>
My page is getting in **Redirection Loop**: This is the main issue.
アムI行方不明any other settings or global.asax event handling
?
私に何か解決策を教えてください。
ありがとうございます。ここで
お返事ありがとう!しかし、これは動作していない、実際に私はブラウザを閉じて、再び任意のURLを参照してください、ページが空白として表示されます!何も起こっていません....それは空白のページとして開きます... – nunu
@nunuは、あなたが '[Authorize]'属性で飾られた操作を試みていますか?これが、ユーザーが認証されていない場合にログイン画面にリダイレクトされる原因です。 –
いいえ、[承認]属性を使用していません。実際に私がどのページに戻ってきても、何ページ分のリクエストがあっても、白いページを開いています... – nunu