all groups > sql server reporting services > september 2005 >
You're in the

sql server reporting services

group:

Pass user credentials RS web service?



Pass user credentials RS web service? Burt
9/26/2005 1:23:04 PM
sql server reporting services: I'm using the RS web service to pull back customized reports via a C#
app, which is running under a service account.

I need to pass in the user's credentials to the Render method to make
sure the user has been given access to the report on the Security tab
of the front end.

If I pass the default credentials, the service account's credentials
are used.

Can anyone help? Many thanks.

Burt
RE: Pass user credentials RS web service? David Jennaway
9/28/2005 7:23:08 AM
You need to create an instance of System.Net.NetworkCredential.

Try:
rs.Credentials = new System.Net.NetworkCredential(UserName, Password);

instead of:
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;


[quoted text, click to view]
Re: Pass user credentials RS web service? Burt
9/28/2005 12:32:21 PM
David,

Thanks, but how do I get the current user's password? I'm using windows
authentication on this intranet app.

Burt
Re: Pass user credentials RS web service? Burt
9/29/2005 4:14:51 PM
FYI, the solution was:


WindowsImpersonationContext windowsImpersonationContext = null;
WindowsIdentity currentIdentity =
(WindowsIdentity)Thread.CurrentPrincipal.Identity;
windowsImpersonationContext = currentIdentity.Impersonate();

MyService.Credentials =
System.Net.CredentialCache.DefaultCredentials;

windowsImpersonationContext.Undo();
windowsImpersonationContext = null;
AddThis Social Bookmark Button