Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Mate

I have this error, each time i m trying to login in, i am getting the websecurity database connection error and dont know how to fix it please help me. Under my AppStart Folder i have the file called "AuthConfig.cs and place the code as below. On my Web.config this my connectionstring.
<connectionStrings>
   <add name="Mystring" providerName="System.Data.SqlClient" connectionString="Data Source=Gcobanim-L\SQLEXPRESS;Database=RegistrationTable" />
 </connectionStrings>


What I have tried:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Microsoft.Web.WebPages.OAuth;
using WebMatrix.WebData;

namespace eNtsaPortalWebsiteProject
{
    public class AuthConfig
    {
        public static void RegisterAuth()
        {
            WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
        }
    }
}
Posted
Updated 21-Jan-20 1:09am

1 solution

There is no connection string named "DefaultConnection". You should try to use configured name instead (Mystring).
 
Share this answer
 
Comments
gcogco10 21-Jan-20 7:16am    
I have change the Default to be "Mystring, now i am getting Database.Sql.ClientException login failed for user
phil.o 21-Jan-20 7:21am    
Then there is something wrong with the credentials you are supplying.
MadMyche 21-Jan-20 7:26am    
wow... how we can't see what is right in front of us
phil.o 21-Jan-20 7:29am    
I'm wondering, too :)
OriginalGriff 21-Jan-20 7:37am    
"But that connection string worked in the YouTube tutorial I fast forwarded through" :sigh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900