I'm having a few problems using SSRS currently. I have an ASP.NET website that uses Windows Authentication. That works fine and I know the website current user is the currently logged on user.
On this site is a webforms ReportViewer. This works fine when I don't set credentials. However looking at the execution log for the reports in SQL Server the Username is listed as DOMAIN\MACHINE.
I've tried setting the ReportServerCredentials property to a class like the one below:
[Serializable]
public class ReportCredentials : IReportServerCredentials
{
public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority)
{
authCookie = null;
userName = null;
password = null;
authority = null;
return false;
}
public WindowsIdentity ImpersonationUser
{
get {
return (WindowsIdentity)HttpContext.Current.User.Identity;
}
}
public ICredentials NetworkCredentials
{
get {
return null;
}
}
}
However, when this code executes I now get a 401 back from the web service and report service.
What's going on? They're both on the same domain. I want to use the current user and not the current machine. If I run the report on the report server it lists under the correct username, just not from my website.