I can not seem to get sql server to recognize my credentials.
Asp.net recognizes me when I login but when I execute a sql command I get a login failed message.
This is key = The IIS server and SQL server are on different machines. You're facing the classic double hop issue. Think of it in this way:
Thus once you enable delegation as mentioned by Remus, your SQL Server will trust the credentials your IIS server is presenting on your behalf.
In terms of security, under delegation, it would be wise to choose:
Trust this computer for delegation for specified services only | Use Kerberos only | and then underneath the "Services to which this account can present delegated credentials" make sure you explicitly set only the server/port you need.
Are your ISS server and SQL Server running on the same machine?
If not, Active Directory has to be configured to allow your IIS server to impersonate your accout towards the SQL Server. See How To: Use Protocol Transition and Constrained Delegation in ASP.NET 2.0.
You also need to enable constrained delegation:
Long story short: IIS server should have "trusted for delegation" checkbox checked in Active Directory.
You need to set you credentials in Application Pool. - Open IIS - Select Application Pools - Enter the name, select .Net framework version and click OK - Select the new added application pool and click on Advanced Settings.. - In the Process Model section click on Identity - choose custom account and enter the AD username, password, confirm password and click OK - Select your application and in the Basic settings choose your application pool just created.
Hope this helps