问题ASP.NET的登录控件 [英] Problem with Login control of ASP.NET

查看:111
本文介绍了问题ASP.NET的登录控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个网站使用的SqlMembershipProvider在此页

I set up a website to use SqlMembershipProvider as written on this page.

我也跟着每一步。我有数据库,我修改的Web.config使用该提供商,拥有正确的连接字符串和身份验证模式设置为Forms。创造了一些用户来测试。

I followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.

我创建了一个为Login.aspx,并把它的登录控制。一切工作正常,直到用户可以登录点。

I created a Login.aspx and put the Login control on it. Everything works fine until the point that a user can log in.

我把Default.aspx的,它就会被重定向到的Login.aspx,我输入用户和正确的密码。没有错误消息,似乎没有什么是错的,但我看到了再次登录表单,输入用户的登录信息。但是如果我检查cookies在浏览器中,我可以看到,具有指定名称的cookie存在。

I call Default.aspx, it gets redirected to Login.aspx, I enter the user and the correct password. No error message, nothing seems to be wrong, but I see again the Login form, to enter the user's login information. However if I check the cookies in the browser, I can see that the cookie with the specified name exists.

我已经尝试自己处理事件,并检查,什么是他们发生的事情,但没有成功。

I already tried to handle the events by myself and check, what is happening in them, but no success.

我使用VS2008,在网站文件系统,SQL防爆preSS 2005存储ASPNETDB,没有角色管理,随着K-Meleon的,IE7.0和Chrome测试。

I'm using VS2008, Website in filesystem, SQL Express 2005 to store aspnetdb, no role management, tested with K-Meleon, IE7.0 and Chrome.

任何想法?

解决方案:一些邮件与Rob后,我们有理想的解决方案,这是目前公认的答案

Resolution: After some mailing with Rob we have the ideal solution, which is now the accepted answer.

推荐答案

我在你(再次感谢发送他们通过)发过来的文件,检查code以上。

I have checked the code over in the files you have sent me (thanks again for sending them through).

注意:因为我还没有安装数据库我没有测试此等。

不过,我pretty肯定这是问题。

However, I am pretty sure this is the issue.

您需要设置的的MembershipProvider 的属性为ASP.NET控件。使得定义为他们:

You need to set the MembershipProvider Property for your ASP.NET controls. Making the definitions for them:

<asp:Login ID="Login1" runat="server" 
    MembershipProvider="MySqlMembershipProvider">
    <LayoutTemplate>
        <!-- template code snipped for brevity -->
    </LayoutTemplate>
</asp:Login>

和..

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
    MembershipProvider="MySqlMembershipProvider">
        <WizardSteps>
            <asp:CreateUserWizardStep runat="server" />
            <asp:CompleteWizardStep runat="server" />
        </WizardSteps>
    </asp:CreateUserWizard>

这则绑定控件与给定名称的成员资格提供程序(你在web.config中指定。

This then binds the controls to the Membership Provider with the given name (which you have specified in the Web.Config.

这给解决方案中的一抡,让我知道你上车。
我希望这对你的作品:)

Give this a whirl in your solution and let me know how you get on. I hope this works for you :)

我还要补充,我知道你不应该需要这样做,因为默认的服务提供商设置的,但我的有无的经本在过去的问题。我结束了他们设置的所有手动和所有工作得很好。

I should also add, I know you shouldn't need to do this as the default provider is set, but I have had problems in the past with this.. I ended up setting them all to manual and all worked fine.

这篇关于问题ASP.NET的登录控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆