Calling SSRS Report Server it asked "Authentication Required" window

Gaurav Agrawal picture Gaurav Agrawal · Jul 13, 2012 · Viewed 10.7k times · Source

I have just started working in SSRS and I got a very strange problem i.e. When I am calling report server URL i.e. localhost/Reports

This URL requires Authentication window for Username and password. like this. enter image description here

If I submitted local system user account information in that case it will appear me report server screen which we want. like this. enter image description here

I have created a demo web-application and in the default.aspx page I am using ReportViewer to show report and configure it. here is the code which i am using Default.aspx Page

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%">
</rsweb:ReportViewer>

Default.aspx.cs Page

    ReportViewer1.ProcessingMode = ProcessingMode.Remote;
    IReportServerCredentials irsc = new CustomReportCredentials("username", "password", "India");
    ReportViewer1.ServerReport.ReportServerCredentials = irsc;
    ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/Reports");
    ReportViewer1.ServerReport.ReportPath = "/SSRS_Demo/Report_CaseMain";
    ReportViewer1.ServerReport.Refresh(); 

CustomReportCredentials.cs Class

public class CustomReportCredentials : IReportServerCredentials
    {
        // local variable for network credential.
        private string _UserName;
        private string _PassWord;
        private string _DomainName;
        public CustomReportCredentials(string UserName, string PassWord, string DomainName)
        {
            _UserName = UserName;
            _PassWord = PassWord;
            _DomainName = DomainName;
        }
        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;  // not use ImpersonationUser
            }
        }
        public ICredentials NetworkCredentials
        {
            get
            {
                // use NetworkCredentials
                return new NetworkCredential(_UserName, _PassWord, _DomainName);
            }
        }
        public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
        {
            // not use FormsCredentials unless you have implements a custom autentication.
            authCookie = null;
            user = password = authority = null;
            return false;
        }
    }

And while i am running this web-application in that case it will gives me an error i.e. enter image description here

Please help me out what will I do to resolve these all errors.....

Answer

Gaurav Agrawal picture Gaurav Agrawal · Jul 13, 2012

After very long R&D I got a solution. I am using wrong SSRS service URL. I am using localhost/Reports but actually the SSRS Reporting Server URL is localhost/ReportServer. So by using this new Reporting Service URL i got the solution of that problem.