Question

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> 
Was it helpful?

Solution

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

OTHER TIPS

Please refer this hope this will help

How to: Use the ASP.NET Membership Provider

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top