New Posts New Posts RSS Feed: IAuthenticationService.Login continue to show "The login credentials supplied are invalid"
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

IAuthenticationService.Login continue to show "The login credentials supplied are invalid"

 Post Reply Post Reply
Author
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Topic: IAuthenticationService.Login continue to show "The login credentials supplied are invalid"
    Posted: 13-Dec-2011 at 12:08am
Hello,
I need to add to my wpf application a login function... I've generated on a test DB the aspnetdb using aspnet_regsql.exe, I've added in my Caliburn micro bootstrapper those lines (in the Configure method)

var securityRepository = new SecurityEntities();

var admin = new AuthenticationService<SecurityEntities>(securityRepository);


and in my loginviewmodel I've the Login method


public void Login()

{

    var loginCredential = new LoginCredential(_userName, _password, null);

    bool isLogged = _authenticationService.Login(loginCredential);

}


I've created as imple user in the aspnetdb using the stored procedure that's Paolo/paolo ... but I continue to receive "The login credentials supplied are invalid."

My web.config (for the server part is)

<ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">
    <logging logFile="log\DebugLog.xml" />
    <objectServer>
      <serverSettings loginManagerRequired="false" useAspNetSecurityServices="true"/>
    </objectServer>
    <!-- Additional configuration can be added to override defaults.
         See the sample config files in the Learning Resources for more information.
    -->
  </ideablade.configuration>
...
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <authentication mode="Forms"></authentication>
  </system.web>

What am I doing wrong?
Thanks
Paolo
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 13-Dec-2011 at 7:31am
What's the membership provider name for AspAuthenticatingLoginManager?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 13-Dec-2011 at 1:43pm
The AspAuthenticatingLoginManager uses the default Membership provider, defined either in web.config or the machine.config.  If you haven't changed the provider then it will use the SqlMembershipProvider and a SQLExpress database.
 
It sounds like you might not be using SQLExpress, so to tell the provider where the database is you need to give it the correct connection string for "LocalSqlServer", for example:
 
<connectionStrings>
  <remove name="LocalSqlServer" />        
  <add name="LocalSqlServer" connectionString="data source=.;Integrated Security=SSPI;Initial Catalog=aspnetdb;" providerName="System.Data.SqlClient"/>
 </connectionStrings>
 
You may also need to check the AspNetSqlMembershipProvider settings in your machine.confg for the password format, and adjust as overrides in your web.config if necessary.  But first try the connection string change to see if that solves the problem. 
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 13-Dec-2011 at 10:16pm
Hello,
I've checked this yesterday (the connection string) and it was ok... in fact if I set it to a wrong DB it won't connect and throw me a server not found exception.... I generated the DB with framework 4.0 ...why it should be wrong? is there a way of checking which kind of encryption it uses? the exception is thrown even if the username doesn't exist... is it normal?
Thanks
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 14-Dec-2011 at 10:49am
The AspAuthenticatingLoginManager is calling Membership.ValidateUser with your supplied credentials, and because this call is returning false, the login manager is throwing the exception.  It's not "normal", but it's expected when the credentials don't validate.
 
I think the problem is that you used the CreateUser stored procedure and the password was either not encrypted or encrypted with a different algorithm.  It would be best to recreate the user using the ASP.NET Configuration tool, which will create the user with the hashing algorithm in effect for the web site.  You can access the tool from the Project menu for the web application project within Visual Studio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down