p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   failed to login with membershipprovider (http://p2p.wrox.com/showthread.php?t=57425)

swifty_programmer May 3rd, 2007 10:58 AM

failed to login with membershipprovider
 
Hi all,
I'm making a quite simpel website for the support in my company.
Not everyone should be able to do all the actions (ex: add customer...) so I want a role based security on my webpage.
I choosed to store credentials and roles in a SQL 2005 Enterprise Ed. DB through the command "asp_reg..."
DB was created successfully(name: membershipDB).
I've added rolemanager (with provider) and membership provider in de web.config.
I'm able to add users, roles... via Web Site Administration Tool.
But when I want to login with one of those users, I can't...
This is REALY frustrating!
I've tried the Membership.ValidateUser(username, password) and it returns false?!?... I've checked every character in my code three times and I do not understand. All help are welcome!

Grtz

Imar May 3rd, 2007 11:38 AM

If you're looking in the aspnet_Applications table, how many records do you see? Maybe you created users in one app, and try to login for another.

Since ASP.NET creates apps for you automatically, there may be a mismatch...

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

swifty_programmer May 4th, 2007 02:01 AM

I'v checked the SQL db, I have only 1 row with the correct applicationName in aspnet_Applications.
All my user are correctly linked to the applicationId.
The DB looks allright, and the membership provider and connectionstrings too. It's only a problem when I try to acces it via my code...
Here's a copy of the web.config:

<?xml version="1.0"?>

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <add key="IntelliServerUrl" value="tcp://localhost:40000/IntelliServer_v4"/>
  </appSettings>
  <connectionStrings>
    <add name="membershipDB"
         connectionString="Data Source=GEO-DC01;Initial Catalog=membershipDB;Persist Security Info=True;User ID=***;Password=***"
        providerName="System.Data.SqlClient" />
    <add name="IntelliServer_v4"
        connectionString="Data Source=GEO-DC01;Initial Catalog=IntelliServer_v4;Persist Security Info=True;User ID=***;Password=***"
        providerName="System.Data.SqlClient" />
    <add name="IntelliTracer_v1"
        connectionString="Data Source=GEO-DC01;Initial Catalog=IntelliTracer_v1;Persist Security Info=True;User ID=***;Password=***"
        providerName="System.Data.SqlClient" />
    <add name="IntelliTracer_v3"
    connectionString="Data Source=GEO-DC01;Initial Catalog=IntelliTracer_v3;Persist Security Info=True;User ID=sa;Password=mile%9000stone"
    providerName="System.Data.SqlClient" />
  </connectionStrings>

    <system.web>

        <compilation debug="true" />

      <authentication mode="Forms">
        <forms name="adminAuth"
               path="/"
               loginUrl="login.aspx"
               protection="All"
               timeout="30"
               requireSSL="false"
               slidingExpiration="true">
        </forms>
      </authentication>

      <roleManager enabled="true" defaultProvider="SqlRoleManager">
        <providers>
          <add name="SqlRoleManager"
               type="System.Web.Security.SqlRoleProvider"
               connectionStringName="membershipDB"/>
        </providers>
      </roleManager>

      <membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="15">
        <providers>
          <clear />
          <add
            name="SqlMembershipProvider"
            type="System.Web.Security.SqlMembershipProvider"
            connectionStringName="membershipDB"
            enablePasswordRetrieval="false"
            enablePasswordReset="false"
            requiresQuestionAndAnswer="false"
            requiresUniqueEmail="false"
            applicationName="/GeoDynamics.IntelliTracer.Admin.Web"
            passwordFormat="Clear"
            />
        </providers>
      </membership>
      <authorization>
        <allow users="*" />
      </authorization>

    </system.web>
</configuration>

Imar May 4th, 2007 02:53 AM

The only thing I can see is that you're missing an applicationName for the RoleProvider. Otherwise, I can't see why this doesn't work...

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.


All times are GMT -4. The time now is 03:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.