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

I have created a windows authentication for my application and I have used my credentials in the applicationpool identity and I have not added my login credentials in the database and hence I am getting the following exception

Login failed for the user 'username'.

I want to know whether it is possible to perform windows authentication without adding the login credentials in the database
Posted

1 solution

It depends what you are logging in to.

You need to connect to the SQL server using windows authentication, that way your kerberos tokens are passed from the site, not the username/password. It is achieved easily in the web application's web.config:

XML
<connectionStrings>
  <add name="DBConnName" connectionString="Initial Catalog=Foo;Data Source=Bar;Integrated Security=SSPI;"/>
</connectionStrings>


Where the bold part tells IIS to pass the windows credential tokens across.

Then you need to grant the windows account running the IIS process access, details here[^].


Using your own account is a badish idea, if you change your password your site will stop working. You need to set up an account specially, note that in either case the account needs to reachable by both the IIS server and the SQL server so it must be in a domain both trust.

There is the usal dry advice from MS on the whole process here[^].
 
Share this answer
 

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