2005 Reporting Services ReportViewer Control

Discussion in 'Databases' started by jjoslin, Aug 24, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm having trouble getting my reports to run via a web page at DiscountASP using the reportviewer/Report Server approach. I copied the Microsoft code to create the MyReportServerCredentials class. Using debug I have confirmed that the report server URL, report path, user ID, user password, and domain name are being correctly passed. I still get the "The request failed with HTTP status 404: NotFound".

    I've successfully displayed the reports on my development machine using my network report server as well as an intranet (VPN connection) report server.

    Here is the code: (as suggested by an article in the forum)

    ReportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials();



    ReportViewer1.ProcessingMode = ProcessingMode.Remote;


    ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerDASPEndPoint"]);


    ReportViewer1.ServerReport.ReportPath = "/myFolder/reports/UserReport";


    It would be great to get the report running using this method because of the vast amount of development time that is saved.


    Is there anybody out there running reports on the DiscountASP Report Server using this approach?


    Thanks,


    John
     
  2. I forgot to add the fact that I can run the reports successfully using the DiscountASP Report Manager.
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Yes. In fact, several times thinking I had missed something. I've set up the web page per the model discussed in that link. I double checked all of my credentials, URL, and report path. Like I said, the web page works fine in a network/VPN intranet environment.

    The only difference in the code behind is the addition of the credentials statement. I know the class executes properly because I put debug on it to verify all of the information.
     
  5. You can download the sample reportviewer controlapplication here:http://daspstaff00.web120.discountasp.net/Report/WebSite8.zip


    The following information needs to added/modified in the above smaple application:


    Web.config (Update 'YourRSUserName' ,'YourRSUserName' and 'YourRSDomain')


    <appSettings>
    <add key="ReportingServiceUser" value="YourRSUserName"/>
    <add key="ReportingServicePassword" value="YourRSUserName"/>
    <add key="ReportingServiceDomain" value="YourRSDomain"/>
    </appSettings>


    default.aspx (Update [DASP_UserName] and [Report_name] where the laterwill be replaced by your report name).


    ReportPath="/[DASP_UserName]/reports/[Report_name]"


    Hope this helps!







    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. I downloaded the code and did a comparison to my code (C#). I followed the example and set up the report path, remote indicator, and URL in the report viewer properties instead of using statements in the code behind. The report still fails. I double checked all of the variables by comparing them to the information on MY SSRS admin page. The only difference, besides the language, (compared to the sample code) is that the credential class is in my App_Code project folder. I do have a push button on the report page to actually display the report. Authentication mode in my web.config is set to "Windows" as it is in the config file I downloaded from the site.

    Here are the settings in the web.config file:



    <appSettings>


    <add key="ReportViewerUser" value="rs_myusername"/>


    <add key="ReportViewerPassword" value="mypassword"/>


    <add key="ReportViewerDomain" value="mydomain"/>


    </appSettings>


    Here is the code behind:


    ReportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials();





    I would attach my credentials code but the attachment manager will not allow. I get a message that says:


    * You cannot upload files that use MIME type : text/plain.


    I copied the c# credentials code form the MS site that you guys had mentioned in previous posts.


    I've written server RSSS 2000 reports that run at DiscountASP for another client.Obviously I'm missing a key ingredient in the 2005 environment.


    Thanks for your help.


    John
     
  7. At this point I am looking at everything. This is a test site that has an address of xxx.mainsite.com/testsite. The reports are being executed from the testsite sub domain. Could this be causing a credentials problem when I specify the domain name as "mainsite.com"?
     
  8. One other thing....


    I have a push button on the page that calls the report. IE, the page loads and the push button is pressed to display the report. The 401 error appears when the page is loaded and before the push button is pressed to load the report. After the push button is pressed this error appears:

    • <LI style="DISPLAY: inline; FONT-WEIGHT: normal; FONT-SIZE: 8pt; FONT-FAMILY: Verdana">The request failed with HTTP status 404: Not Found.



    I am also using a master page. Could this be causing a problem?



    Post Edited By Moderator (bruce [DASP]) : 8/27/2007 5:53:18 PM GMT
     
  9. Well it seems I left the "ReportServer" off the end of the URL. So, correcting this eliminated the "404 not found" problem. I'm still getting the "401 unauthorzied" problem. I added a new user on my admin panel and this still did not work.
     
  10. I decided to try your VB sample site and it worked! I then did a C# site like the VB sample and it worked!

    Now here is the interesting part on the site that did not work: My "Page_Load" section of the code behind contained no code. I had a push button on the web form (mostly out of habit) for the user to press to display the report. The Reportviewer credentials statement was placed in the click event of the push button. When I removed the push button and placed the ReportViewer credentials statement in the Page_Load section of the code, my test site worked!!! What do you think is going on here?

    Anyway, thanks very much for your help!! I could have saved my self a lot of time if I had tried more variations of the code behind.

    John
     
  11. The issue is due to the 'ServerReport' within the 'ReportViewer' .You can bypass the error message with something as follows within your button event handler:




    ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials()


    //Set the following in the code behind instead .Remove the 'ServerReport' from the aspx page.


    ReportViewer1.ServerReport.DisplayName = ""


    ReportViewer1.ServerReport.ReportPath = ""


    ReportViewer1.ServerReport.ReportServerUrl = New System.Uri("")


    You do not need to have the Reportviewer credentials statement in your page load then.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  12. One final note: To save other developers a bunch of research time.


    Ifdata entry is required before the report is ran, set the reportviewer's visible property to false in the Page_Load section of the code. Then in the code that displays the actual report, set the reportviewer's visible property to true. If there is no code in the Page_Load section, you will get the 401 message and the report will fail.
     
  13. yeah ,thats another option.The 'ServerReport' with the Reportviewer control causes the error with nothing within the Page load event handler,as I had mentioned in my earlier post.




    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page