none
The request failed with HTTP status 401: Unauthorized.

    Question

  • Hi,

    I searched the whole forum but no correct answer.

    We have a Sql Server 2008 R2 Reporting Services, Database Engine and a Secure (Https/SSL) Web Application (.Net 3.5). Database, Reporting and IIS Server are on the same machine.

    Our web application is reached via Internet. (like https://www.bdoprtl.com/Login.aspx)

    And we have some .RDL reports and we want to show these reports on our own .aspx pages with Report Viewer control. We use our custom user/role management system.

    But when we want to show report, we get an error like this :

        The request failed with HTTP status 401: Unauthorized.

    When we look at the event log of the server, we see 2 items on Security section. The first one is successful and the second one is failed/error!! What we saw on the 2nd message is



    An account failed to log on.
    
    Subject:
    	Security ID:		NULL SID
    	Account Name:		-
    	Account Domain:		-
    	Logon ID:		0x0
    
    Logon Type:			3
    
    Account For Which Logon Failed:
    	Security ID:		NULL SID
    	Account Name:		TEST\APP_USER
    	Account Domain:		
    
    Failure Information:
    	Failure Reason:		Unknown user name or bad password.
    	Status:			0xc000006d
    	Sub Status:		0xc0000064
    
    Process Information:
    	Caller Process ID:	0x0
    	Caller Process Name:	-
    
    Network Information:
    	Workstation Name:	TEST
    	Source Network Address:	-
    	Source Port:		-
    
    Detailed Authentication Information:
    	Logon Process:		NtLmSsp 
    	Authentication Package:	NTLM
    	Transited Services:	-
    	Package Name (NTLM only):	-
    	Key Length:		0

    And here is the web.config impersonation (APP_USER is Local Admin) section

     

      <authentication mode="Windows" />
      <identity impersonate="true" userName="TEST\\APP_USER" password="111111aA"></identity>

    Here is the code for ReportView.aspx.cs   
    protected void Page_Load(object sender, EventArgs e)
     { 
      repViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
      repViewer.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials();
    
      repViewer.ServerReport.ReportServerUrl = new Uri("http://81.46.212.75:8090/Reports");
      repViewer.ServerReport.ReportPath = "/MAT/Order Report";
    
      repViewer.ServerReport.Refresh();
     }

    How can we solve this?

    Regards.


    Tuesday, August 23, 2011 10:46 AM

Answers

  • Hi sourvil,

    Thanks for your post.

    Based on your description, all the resources involved in your project are installed on your local machine. So it’s unneccesary to specify impersonation enabled for your local admin account in your project,if you current account is local admin account which can access your report server, I would suggest you to delete the identity section in the web.config file , then delete the credentials setting code,leave your code like below:
    protected void Page_Load(object sender, EventArgs e)
     {
       repViewer.ShowCredentialPrompts=false;
      repViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

      repViewer.ServerReport.ReportServerUrl = new Uri("http://81.46.212.75:8090/ReportServer");
      repViewer.ServerReport.ReportPath = "/MAT/Order Report";

      repViewer.ServerReport.Refresh();
     }

    Finally, configure your website to Windows authentication in IIS, then have a try.

    More information about this topic, please refer to the articles below:
    ASP.NET Impersonation: http://msdn.microsoft.com/en-us/library/aa292118(v=VS.71).aspx
    Configure Windows Authentication (IIS 7): http://technet.microsoft.com/en-us/library/cc754628(v=WS.10).aspx

    If you have anything unclear, please feel free to let me know.

    Thanks,
    Bill Lu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by sourvil Thursday, August 25, 2011 6:20 AM
    Thursday, August 25, 2011 6:09 AM
    Moderator
  • I figured it out.

    First, address should be http://81.46.212.75:8090/ReportServer not http://81.46.212.75:8090/Reports

    And if your report server is not in a domain, you should put "." for Domain info for Report Server Credentials.

     

    Regards.

    • Marked as answer by sourvil Thursday, August 25, 2011 6:20 AM
    Thursday, August 25, 2011 6:20 AM

All replies

  • Hi sourvil,

    Thanks for your post.

    Based on your description, all the resources involved in your project are installed on your local machine. So it’s unneccesary to specify impersonation enabled for your local admin account in your project,if you current account is local admin account which can access your report server, I would suggest you to delete the identity section in the web.config file , then delete the credentials setting code,leave your code like below:
    protected void Page_Load(object sender, EventArgs e)
     {
       repViewer.ShowCredentialPrompts=false;
      repViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

      repViewer.ServerReport.ReportServerUrl = new Uri("http://81.46.212.75:8090/ReportServer");
      repViewer.ServerReport.ReportPath = "/MAT/Order Report";

      repViewer.ServerReport.Refresh();
     }

    Finally, configure your website to Windows authentication in IIS, then have a try.

    More information about this topic, please refer to the articles below:
    ASP.NET Impersonation: http://msdn.microsoft.com/en-us/library/aa292118(v=VS.71).aspx
    Configure Windows Authentication (IIS 7): http://technet.microsoft.com/en-us/library/cc754628(v=WS.10).aspx

    If you have anything unclear, please feel free to let me know.

    Thanks,
    Bill Lu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by sourvil Thursday, August 25, 2011 6:20 AM
    Thursday, August 25, 2011 6:09 AM
    Moderator
  • I figured it out.

    First, address should be http://81.46.212.75:8090/ReportServer not http://81.46.212.75:8090/Reports

    And if your report server is not in a domain, you should put "." for Domain info for Report Server Credentials.

     

    Regards.

    • Marked as answer by sourvil Thursday, August 25, 2011 6:20 AM
    Thursday, August 25, 2011 6:20 AM