なぜ私のasp.netメンバーシップのログインページがリダイレクトでは動作しませんか?

StackOverflow https://stackoverflow.com/questions/883830

質問

私は、ASP.NETメンバシッププロバイダを使用して、私のローカルマシン上でこの会員制サイトを設定しています。私が行くときます:

ます。http:// localhost /を管理/

これは、私をリダイレクトします。

ます。http:?//localhost/Login.aspxにreturnurl =%2fadmin%2fDefault .aspxの

どの結構です。私は私のログイン情報に入れた後、しかし、ページがちょうど更新しているようです。それは実際に私がログインしていない、そしてそれはページを更新するようにそれはちょうど見えます。私はURLを変更する場合:

ます。http://localhost/Login.aspxする

これは正常に動作します。それは何の問題で私を記録し、私のデフォルトのページに私をリダイレクトします。私はまた、ライブサイトをチェックし、それは同じことを行います。何か案は?事前に感謝します!

編集:ここではマークアップはあります:

<asp:Login ID="Login1" runat="server" CssClass="LoginBox" TitleText="Please Log In">
    <LayoutTemplate>
        <h2>
            Please Log In:</h2>
        <p runat="server" id="FailureText" visible="false">
            Either your email address or password was incorrect. Please try again.</p>
        <strong>Email</strong><br />
        <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
            Text="*"></asp:RequiredFieldValidator>
        </p>
        <p>
            <strong>Password</strong><br />
            <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                Text="*"></asp:RequiredFieldValidator>
        </p>
        <p>
            <asp:Button ID="Login" CommandName="Login" runat="server" Text="Log In" /></p>
        <p>
            Please <a runat="server" id="Link_ContactUs">contact </a>an administrator if you
            are having trouble logging in or have forgotten your password.</p>
    </LayoutTemplate>
</asp:Login>

web.configファイルのセットアップ:

<authentication mode="Forms">
  <forms loginUrl="/Login.aspx"
         protection="All"
         timeout="60"
         name="AppNameCookie"
         path="/Admin"
         requireSSL="false"
         slidingExpiration="true"
         defaultUrl="/Admin/Default.aspx"
         cookieless="UseCookies"
         enableCrossAppRedirects="false" />
</authentication>
役に立ちましたか?

解決

あなたは私たちにいくつかのコードを表示することができますか?あなたはFormsAuthentication.RedirectFromLoginPageメソッドを使用している場合は、あなたが望む結果を得る必要があります。あなたの代わりにFormsAuthentication.SetAuthCookieを使用していますか?

更新

path="/Admin"するweb.config

変更path=/

それが動作しない理由は、それがバック/Adminページ(小文字/admin/Default.aspx)に認証クッキーを送信しませんので、あなたの認証Cookieのみ大文字と小文字を区別としてadminパスとブラウザの扱いのURLに設定されていることです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top