ASP .NET 2.0 Membership issue ... Your login attempt was not successful.

Discussion in 'ASP.NET 2.0' started by jfurnier, Jan 2, 2008.

  1. I too have been able to save the user names and passwords to the database which is on discountasp servers. But when I try to login, it tells me 'Your login attempt was not successful.'. I have added the applicationname="/" to the <membership> and it still doesn't work. Is there anything that needs to be tweaked to be able to actually log in one of the users I have created?Thank you very much!
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. I wouldcheck the entries in your membership database:

    1. Open the aspnet_Applications table and see what the ApplicationName is.
    2. Open the aspnet_Users table and see if theUserName you created exist and that their corresponding ApplicationId is correct.



    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. Thank you for the suggestion but I did follow that article prior to the initial posting.

     
  5. Take a look at this:
    http://authors.aspalliance.com/aspxtreme/sys/web/security/MembershipClass.aspx


     
  6. Can you post your web.config, edit out the password in your connection string. Thanks.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  7. <!--


    Note: As an alternative to hand editing this file you can use the


    web admin tool to configure settings for your application. Use


    the Website->Asp.Net Configuration option in Visual Studio.


    A full list of settings and comments can be found in


    machine.config.comments usually located in


    \Windows\Microsoft.Net\Framework\v2.x\Config


    -->


    <configuration>


    <configSections>


    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">


    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">


    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>


    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">


    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>


    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>


    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>


    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>


    </sectionGroup>


    </sectionGroup>


    </sectionGroup>


    </configSections>


    <appSettings/>


    <connectionStrings>


    <remove name="LocalSqlServer" />


    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k505.discountasp.net;Integrated Security=false;Initial Catalog=SQL2005_419191_sportstalk;User ID=*****;Password=*****"


    providerName="System.Data.SqlClient" />


    </connectionStrings>


    <system.web>


    <!--


    Set compilation debug="true" to insert debugging


    symbols into the compiled page. Because this


    affects performance, set this value to true only


    during development.


    Visual Basic options:


    Set strict="true" to disallow all data type conversions


    where data loss can occur.


    Set explicit="true" to force declaration of all variables.


    -->


    <authorization>


    <allow roles="Administrator" />


    </authorization>


    <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">


    <providers>


    <clear/>


    <add name="AspNetSqlRoleProvider"


    type="System.Web.Security.SqlRoleProvider"


    connectionStringName="LocalSqlServer"


    applicationName="/SportsTalkCoastToCoast"


    />


    </providers>


    </roleManager >


    <membership defaultProvider="AspNetSqlMembershipProvider">


    <providers>


    <clear/>


    <add name="AspNetSqlMembershipProvider"


    type="System.Web.Security.SqlMembershipProvider"


    connectionStringName="LocalSqlServer"


    applicationName="/SportsTalkCoastToCoast"


    />


    </providers>


    </membership>


    <authentication mode="Forms" />


    <compilation debug="true" strict="false" explicit="true">


    <assemblies>


    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add assembly="System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>


    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


    </assemblies>


    </compilation>


    <pages>


    <namespaces>


    <clear/>


    <add namespace="System"/>


    <add namespace="System.Collections"/>


    <add namespace="System.Collections.Generic"/>


    <add namespace="System.Collections.Specialized"/>


    <add namespace="System.Configuration"/>


    <add namespace="System.Text"/>


    <add namespace="System.Text.RegularExpressions"/>


    <add namespace="System.Linq"/>


    <add namespace="System.Xml.Linq"/>


    <add namespace="System.Web"/>


    <add namespace="System.Web.Caching"/>


    <add namespace="System.Web.SessionState"/>


    <add namespace="System.Web.Security"/>


    <add namespace="System.Web.Profile"/>


    <add namespace="System.Web.UI"/>


    <add namespace="System.Web.UI.WebControls"/>


    <add namespace="System.Web.UI.WebControls.WebParts"/>


    <add namespace="System.Web.UI.HtmlControls"/>


    </namespaces>


    <controls>


    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    </controls>


    </pages>


    <!--


    The <authentication> section enables configuration


    of the security authentication mode used by


    ASP.NET to identify an incoming user.


    -->


    <!--


    The <customErrors> section enables configuration


    of what to do if/when an unhandled error occurs


    during the execution of a request. Specifically,


    it enables developers to configure html error pages


    to be displayed in place of a error stack trace.


    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">


    <error statusCode="403" redirect="NoAccess.htm" />


    <error statusCode="404" redirect="FileNotFound.htm" />


    </customErrors>


    -->


    <httpHandlers>


    <remove verb="*" path="*.asmx"/>


    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>


    </httpHandlers>


    <httpModules>


    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    </httpModules>


    </system.web>


    <system.codedom>


    <compilers>


    <compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/warnaserror-" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">


    <providerOption name="CompilerVersion" value="v3.5"/>


    </compiler>


    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/optioninfer+" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">


    <providerOption name="CompilerVersion" value="v3.5"/>


    </compiler>


    </compilers>


    </system.codedom>


    <!--


    The system.webServer section is required for running ASP.NET AJAX under Internet


    Information Services 7.0. It is not necessary for previous version of IIS.


    -->


    <system.webServer>


    <validation validateIntegratedModeConfiguration="false"/>


    <modules>


    <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    </modules>


    <handlers>


    <remove name="WebServiceHandlerFactory-Integrated"/>


    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>


    </handlers>


    </system.webServer>


    </configuration>

     
  8. Thank you for this but I have a question that is why does it save the user and password but when I go to login with that user and password, I get the error message????

     
  9. Assuming that the user you created is in the Administrator role, then I don't see why it shouldn't work. Try resetting the password for that user.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  10. I have a feeling that your development environment is not the same as your live application on the DiscountASP server. Are you sure you uploaded/updated the web.config on your DiscountASP site? It's the only explanation that I can think of at this point.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  11. When I go into the asp .net configuration and I go to provider tab, it says the provider is aspnetsqlprovider which is never referenced in the web.configfile. It does have the correct number of users in it when I go to the Security tab. Does this sound ok to you?

     
  12. When I go into the asp .net configuration and I go to provider tab, it says the provider is aspnetsqlprovider which is never referenced in the web.configfile. It does have the correct number of users in it when I go to the Security tab. Does this sound ok to you?

     
  13. Thank you again for responding to my issue!


    I am currently running this locally on my computer. It isn't put up on the server yet.

     
  14. Have you verified there is anapplicationName of '/SportsTalkCoastToCoast' in the dbo.aspnet_Applications table? The reason I ask is you initially said you had set applicationName="/" butthe web.config you posted states applicationName="/SportsTalkCoastToCoast". Also I compared my existing web.config membership &amp; roleManager tags to yours. My roleManager does notcontainany provider tags defined beneath it. Beloware my web.config values if it's of any help...



    <roleManager enabled="true" />

    <membership>
    <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
    </providers>
    </membership>


    To confirm, my applicationName is currently "/", this may differ for you. I hope I've been of some help.
     
  15.  

Share This Page