質問

I added a create user and login control wizard to my asp website and attached the database from a previously working solution. But when I try to login with a successfully created user I can't login.

My question is am I missing a step in configuring the login control? I know that it uses the default membership provider but do I need to configure it to recognise the database?

This is the login control declaration:

<asp:Login ID="Login1" runat="server" DestinationPageUrl="Home.aspx" FailureAction="RedirectToLoginPage" Height="161px" Width="450px" OnAuthenticate="Login1_Authenticate1" BackColor="#EFF3FB" BorderColor="#B5C7DE" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333">
        <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
        <LoginButtonStyle BackColor="White" BorderColor="#507CD1" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" />
        <TextBoxStyle Font-Size="0.8em" />
        <TitleTextStyle BackColor="#507CD1" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
    </asp:Login>

And the web.config:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <roleManager enabled="true" />
    <authentication mode="Forms" />
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration> 
役に立ちましたか?

解決

It sounds like the connectionString to the Membership database is working, but you may be providing an invalid username or password. You can debug this further by implementing the OnAuthenticate Event:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.authenticate(v=vs.100).aspx

You might also consider just creating a new User and test logging in with the new username and password vai the Membership.CreateUser method:

http://msdn.microsoft.com/en-us/library/t8yy6w3h(v=vs.100).aspx

他のヒント

Please refer this hope this will help

How to: Use the ASP.NET Membership Provider

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