0

What we're trying to do is use Forms Authentication on a website. The user name and password are hit against Active Directory. If that returns a user then we set the formsAuthentication AuthCookie for that user name. We'd like to use that users active directory to connect to sql server.

Things we've tried: setting web.config identity impersonate=true

    string connectionString = "Server=" + dbServ + ";Database=" + dbName + ";Integrated Security=SSPI;User ID=" + dbUser + ";Password=" + dbPass + ";Trusted_Connection=false;";//windows authentication username/pass from active directory
    //string connectionString = "Server="+dbServ+";Database="+dbName+";Trusted_Connection=True;";//trusted connection
    //string connectionString = "Server=" + dbServ + ";Database=" + dbName + ";User Id=" + dbUser + ";Password=" + dbPass + ";";//standard security

If I use Trusted_Connection = true then I just get logged in to SQL server under my account not the test user account that I'm logging in as.

These users will be a part of an active directory group that is also a login we created in sql server(meaning that active directory group is the login).

Is there a way to log someone into sql server via their ActiveDirectory account while on a forms authenticated website? I guess that's the basic question.

Kevin
  • 457
  • 4
  • 12
  • 31
  • Thanks @stuartd I'll try running VS as admin. – Kevin Apr 14 '15 at 23:09
  • My guess you already have added the users in active directory as users in sql server database. – TejSoft Apr 14 '15 at 23:59
  • @TejSoft we didn't add the specific users but we added an active directory group they are in as a log in and user on the sql server. – Kevin Apr 15 '15 at 14:27
  • I left a comment on the other post with the modifications I made to that answer to make it work for me. – Kevin Apr 15 '15 at 18:11

0 Answers0