Search code examples
sql-serverasp.net-mvcrazoriis-10

Pass credentials from ASP.NET to IIS and SQL Server


I have one machine running IIS10, another machine running SQL Server Express. I have create an ASP.NET Razor pages web application. All machines are Windows 10 pro.

I cannot for the life of me figure out how to take the credentials from the web app, pass to IIS, and pass to SQL Server. I want to manager access to SQL Server at the user level, not the IIS DefaultAppPool identity.

Has anyone done this before?


Solution

  • Are you trying to pass the user's network login to the database instead of using a dedicated DB account? I think you need a trusted connection.

    1. Grant your users access to your DB
    2. Disable anonymous access in IIS and set the site up SSL
    3. In your connection string set the Trusted_Connection property to true

    Connection Strings

    If the user is on any browser except IE, they'll probably be prompted for their credentials.