We have an issue in accessing custom a DB from a SharePoint custom webpart. When we try to access the custom DB from SharePoint webpart we are getting the error "Login Failed for User NTAuthority\Anonymous Logon".
This issue occurs in the following scenario: WebApplication exists in seperate server DB Server Instance exists in seperate server and WebApplication AppPool uses "domain\someuser" and DB Server Instance has the same user "domain\someuser" and has permission to Custom DB.
<authentication mode="Windows" /> <identity impersonate="true" />
The connection string we are using is "Data Source=xxxx; Initial catalog=yyy; Integrated security=true;" We have tried with a small change in conneciontion string as well "Data Source=xxxx; Initial catalog=yyy; Integrated security=SSPI;" It didn't work.
It works in 3 scenarios, but these are not acceptable as per our client security rules,
If we modify impersonation to use the domain user
<identity impersonate="true" username=”domain\someuser” password=”***” />
If we add “NTAuthority\Anonymous Logon” as a user in custom DB server instance.
- If we use Sql Authentication “Data Source=xxxx; Initial catalog=yyy; Integrated security=false;user id=sampleuser;password=*;”
Is there any other approach which could be used to resolve this issue?