Yes, you can impersonate the service to run under a dedicated Windows
account. I am doing this in an Intranet application. One advantage of using a
dedicated account, is that allows Connection Pooling when different users
connects to the database. The downsize is that you have to use the user
account/password in the code, something that may not respect the segragation
of duties principle in some companies (where the application administrator is
different from the SQL administrator).
private void StartWebServiceAsReadOnlyIdentity()
{
CredentialCache credentialCache = new CredentialCache();
// Create a new instance of NetworkCredential using the client
// credentials.
NetworkCredential credentials = new NetworkCredential();
credentials.UserName = m_strReadOnlyUserName;
credentials.Password = m_strReadOnlyUserPassword;
credentials.Domain = m_strReadOnlyUserDomain;
// Add the NetworkCredential to the CredentialCache.
credentialCache.Add(new Uri(service.Url),
"Negotiate", credentials);
// Add the CredentialCache to the proxy class credentials.
service.Credentials = credentialCache;
}
"c_shah" wrote:
I have a web application developed in ASP.net 2.0. I have to use SQL
server authentication (Our outside hosting company only allows sql
authentication)
Inside that web application I have a web service referenced that is
actually hosted within our company.
When you use that web service within your ASP.net web application.
What account is used by that web service? (anonymous account use by
ASP.net web application? Can that web service use a different account)
Sorry for my english..