<forms loginUrl="Default.aspx" protection="All" timeout="15" name=".ASPXFORMSAUTH" path="/" requireSSL="true" defaultUrl="Default.aspx" cookieless="UseCookies" enableCrossAppRedirects="false"/>default.aspx是一个登陆界面,
现问为什么登陆界面验证成功后,应转入另一个页面,但它还是这一个default.aspx,哪里写错了?

解决方案 »

  1.   

    你的验证程序有问题<html>
    <head>
    <script language="C#" runat=server>
        void SubmitBtn_Click(Object Source, EventArgs e)
        {
            // Pull credentials from form fields and try to authenticate.
            if (FormsAuthentication.Authenticate(UserName.Value, 
                    UserPassword.Value))
            {
                FormsAuthenticationTicket ticket = new 
                    FormsAuthenticationTicket(UserName.Value, false, 5000);
                      
                FormsAuthentication.RedirectFromLoginPage(UserName.Value,
                    Persist.Checked);
            }
        }
    </script>
    </head><body><form method=post runat=server>
        <table>
            <tr>
                <td>Name:</td>
                <td><input type="text" id="UserName" runat=server/></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type="password" id="UserPassword" runat=server/>
                </td>
            </tr>
        </table>
        <input type="checkbox" id="Persist" runat=server/>
        <!-- Use persistent cookie. -->
        <br>
        <input type="submit" OnServerClick="SubmitBtn_Click" runat=server/>
    </form>
    </body>
    </html>