Report Viewer open with no content

Discussion in 'Databases' started by Page, Feb 22, 2011.

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

    my environment: VS2010 Prof. with Asp.Net 4.0 Application. Inside of a page i use the Report-Viewer Control.

    The webserver is IIS 7.x with Asp.Net 4.0 in clasic mode, so i can not add handlers for Reporting Services with the Remote IIS-Admin Tool.

    The 2008 SSRS with a Sql Server 2008 R2; all from DASP.

    I set the servernam, paht and credantials like in the sample (before i got an authorization error). The Report Viewer open and the 'Ajax-busy-control' spin around but no report data is loaded!

    If i click the Refresh-Button of the control i got an error, that there are problems with the viewstate of the Report Viewer.

    Anyone any ideas???
     
  2. ...Did you manually add the handlers to both the page and your web.config?
    If you did, is it using the correct version?
    There may be a conflict with version 9 and 10.
    If you want me to look at the code I will, no charge.
    All the best,
    Mark
     
  3. Hello Mark,

    thank's for this fast reply.

    I added the part in the web server area of the web.config manualy.

    Extract of web.config:

    <system.web>
    <httpHandlers>
    <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
    </httpHandlers>
    ....

    <assemblies>
    <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    ....


    This tags were inserted by the system.


    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
    <!--<add name="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
    <add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="Unspecified" />
    <!--<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />-->
    <!--<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />-->
    </handlers>
    </system.webServer>


    I added these tags manually by advise of several forum-posts about problems with IIS 7.x.


    These is the code on the click-event of my button:

    protected void WIB_Report_Click(object sender, Infragistics.WebUI.WebDataInput.ButtonEventArgs e)
    {

    //http://rs2k801.discountasp.net/Reports/Pages/Report.aspx?ItemPath=%2fmuseumstick%2fReports%2fSabine%2fTest_1&SelectedSubTabId=GenericPropertiesTab&SelectedTabId=ViewTab
    // My uploaded Test-Report

    this.Rep_Prev.Visible = true;
    this.Rep_Prev.ServerReport.ReportServerUrl = new System.Uri("https://rs2k801.discountasp.net/ReportServer");


    string strReport = "/museumstick/Reports/Sabine/Test_1";

    this.Rep_Prev.ServerReport.ReportPath = strReport;

    Rep_Prev.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

    string r_user = "my user";
    string r_pwd = "my secret";
    //string r_dom = "RS2K801";
    string r_dom = "rs2k801.discountasp.net";
    string r_dom = "";

    Rep_Prev.ServerReport.ReportServerCredentials = new ReportCredentials(r_user, r_pwd, r_dom);

    this.Rep_Prev.ServerReport.Refresh();

    }


    public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
    {

    string _userName, _password, _domain;

    public ReportCredentials(string userName, string password, string domain)
    {

    _userName = userName;

    _password = password;

    _domain = domain;

    }

    public System.Security.Principal.WindowsIdentity ImpersonationUser
    {

    get
    {

    return null;

    }

    }



    public System.Net.ICredentials NetworkCredentials
    {

    get
    {

    return new System.Net.NetworkCredential(_userName, _password, _domain);

    }

    }



    public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)
    {

    userName = _userName;

    password = _password;

    authority = _domain;

    authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");

    return true;

    }

    }

    Do you see my error ???

    thanks for help.

    Patric
     
  4. The important part after <system.webServer> is commented out.

    Add this exact section, which is required on IIS7:
    Code:
      <system.webServer>
        <handlers>
          <add name="ReportViewerWebControlHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" preCondition="integratedMode" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </handlers>
    
     
  5. Hello Mark,

    i changed the web.config (insert your tag and comment out the other tags), with the same result: report viewer seems to load but visualize nothing.

    If i click on refresh/reload in browser or on the control i see this strange error:

    [ViewStateException: Ungültiger ViewState.
    Client IP: 127.0.0.1
    Port:
    Referer: http://localhost:59831/Report_Prev.aspx
    Path: /Report_Prev.aspx
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; DaNIK; Creative AutoUpdate v1.40.01)
    ViewState: /wEWNgK0z/7zDQK645XLBQK644HwDAKswYmlDgKswYWlDgKv57yvAQL45fH6DQLwr5oCAtGQx8wIAqrGmcgIAqrGlcgIAqrGhSoCqsaBKgKVy4vtCwKWy4vtCwLaiKj/BgLbiKj/BgK5p8DdDQKMnr2LDgKNnr2LDgLH4KD5AgLI4KD5AgL/qp2ACwKAq52ACwK67YDuDwK77YDuDwLVi6+2BgLVi6u2BgLVi8OsCALVi7+sCAKu3rG2CAKCqPm4CwLisr2QBgLvsr2QBgLussmTBgLusr2QBgLO8+bHAQLM89rHAQLJ8+bHAQLI89rHAQLHnLzlCgLY3Zm4CwLY3a3WAwLlqqHoCALlqo3yBgKw1vKXCQL+k7jNBgLE3vKKBgK20Y+3BgL+z6iWCQK1oaLXDwK7qpe4CwK7qpu4CwK7qv+3C+6WLcamkE7rAQi7Kq3eoMiHmGMF7pfUjBHSd11fXh/Y]

    [HttpException (0x80004005): Die Zustandsinformationen sind für diese Seite ungültig. Möglicherweise sind sie fehlerhaft.]
    System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +198
    System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +246
    System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +64
    System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +113
    System.Web.UI.WebControls.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection) +46
    System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +12
    System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +327
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8431
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
    System.Web.UI.Page.ProcessRequest() +78
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.report_prev_aspx.ProcessRequest(HttpContext context) in c:\Users\wadm\AppData\Local\Temp\Temporary ASP.NET Files\root\b6885687\87fc8eed\App_Web_pj2tzqxj.3.cs:0
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


    I tested the report in the RS-Manger and it worked correct.

    Any hints how i can test the communication between the reporting services web service and the report viewer? May be my authorization and the IReportServerCredentials are wrong. Or some properties of the report viewer control are corrupt.

    Any additional direction to solve the problem?

    Thank's

    Patric
     
  6. Hello,

    in addition i tested my report with this call in IE:

    http://rs2k801.discountasp.net/Repo...Id=GenericPropertiesTab&SelectedTabId=ViewTab

    The system prompt for a login and then renders the report. But there was a javascript error in the taskbar. Inside are several times the same error on a missing object:

    Meldung: Objekt erwartet
    Zeile: 9
    Zeichen: 47
    Code: 0
    URI: http://rs2k801.discountasp.net/Repo...Page=0&PageCountMode=Estimate&LinkTarget=_top


    Can there be a mismatch between my report viewer version (10.x) and the ReportViewer used on the Reporting Services Webservice (it is the 2008 Version; not 2008 R2!) ??
     
  7. ...I'm not sure what's causing this.
    Have you tried the same report but without credentials?
     
  8. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    string r_dom = "rs2k801.discountasp.net";
    string r_dom = "";

    Was string r_dom=""; meant to be commented out?
     
  9. To Tasslehoff:

    Sory, was a copy/paste error. The problem is, that i found no example or description, wath this 'domain'-property is in this context, nor what is the correct syntax (the DNS-String of the Server, the AD-Add on in the Reporting Services, ... ???). So i try several pattern. But it seems to be meaningless.


    To Mark:

    If i try to use the report without credentials, i get an error, that i have no authorization. I also changed the class that create the credentials to be serializable (some post say, that there are several communications steps between the Report Viewer and the Reporting Services).

    [Serializable]
    public sealed class MyReportServerCredentials : IReportServerCredentials
    { ....

    and place the account info in the web.config under the tag appSettings

    // Read the user information from the Web.config file.
    // By reading the information on demand instead of
    // storing it, the credentials will not be stored in
    // session, reducing the vulnerable surface area to the
    // Web.config file, which can be secured with an ACL.

    With this new implementation the ajax spinner turns longer than before, but no report is displayed and no error.

    I think i switch to local reports, the reporting was only a litle part of the project (i realized such tasks with RS2005 and with no problems), but now it become a time-consuming part.

    I post the code - parts, so maybe you see my error.

    in Web.Config:

    <appSettings>
    <add key="ReportViewerServerConnection" value="Museumsticket.RV_Connection, Museumsticket"/>
    <add key="MyReportViewerUser" value="My Username on RS"/>
    <add key="MyReportViewerPassword" value="My Password"/>
    <add key="MyReportViewerDomain" value="RS2K801"/>
    <!-- This is the Domain of the Useraccount on RS-->
    <add key="MyReportServerUrl" value="https://rs2k801.discountasp.net/ReportServer"/>
    </appSettings>


    in Code Behind:

    protected void Page_Init(object sender, EventArgs e)
    {
    //Some posts say, you should use Page_Init, not Page_Load !!!
    Rep_Prev.ServerReport.ReportServerCredentials = new MyReportServerCredentials();
    }


    [Serializable]
    public sealed class MyReportServerCredentials :
    IReportServerCredentials
    {
    public WindowsIdentity ImpersonationUser
    {
    get
    {
    // Use the default Windows user. Credentials will be
    // provided by the NetworkCredentials property.
    return null;
    }
    }

    public ICredentials NetworkCredentials
    {
    get
    {
    // Read the user information from the Web.config file.
    // By reading the information on demand instead of
    // storing it, the credentials will not be stored in
    // session, reducing the vulnerable surface area to the
    // Web.config file, which can be secured with an ACL.

    // User name
    string userName =
    ConfigurationManager.AppSettings
    ["MyReportViewerUser"];

    if (string.IsNullOrEmpty(userName))
    throw new Exception(
    "Missing user name from web.config file");

    // Password
    string password =
    ConfigurationManager.AppSettings
    ["MyReportViewerPassword"];

    if (string.IsNullOrEmpty(password))
    throw new Exception(
    "Missing password from web.config file");

    // Domain
    string domain =
    ConfigurationManager.AppSettings
    ["MyReportViewerDomain"];

    if (string.IsNullOrEmpty(domain))
    throw new Exception(
    "Missing domain from web.config file");

    return new NetworkCredential(userName, password, domain);
    }
    }

    public bool GetFormsCredentials(out Cookie authCookie,
    out string userName, out string password,
    out string authority)
    {
    authCookie = null;
    userName = null;
    password = null;
    authority = null;

    // Not using form credentials
    return false;
    }
    }


    Is there a problem, that i use forms authentication with asp membership provider in my application?

    Web-Config:

    <authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>
     
  10. ...Looks like you have a handle on the membership and no I don't think forums authentication is a problem but, I didn't realize until now that your report was on the Report Server and you are pulling it in via forms auth.

    To be honest this is a tough one to help with.

    You probably realize the same form, but not with all of the features of RS, can be used as a stand alone report on your site.
    Doing it that way you can more easily drill down any error, however as I mentioned the same report without using the RS can't have all of the features of RS.

    Yes it's all very confusing and I'm not trying to add to it. ;-)
     
  11. Hello Mark,

    i know, that there are some limitations on using the report viewer without Reporting Services. But with the following hints i get my report in local Mode doing all i need (view report, export to word or pdf for printing).

    The way was easy:

    1. Rename the rdl to rdlc and copy the file to the asp-project (don't forget to include the file).

    2. On the page with the report-viewer control add a Sql-Datasource, with the data that the report use (i use a stored procedure, that deliver the data in a denormalized mode; and i know, that a manualy created dataset is better; may be next step).

    Then in code behind:

    //// Set the processing mode
    Rep_Local.ProcessingMode = ProcessingMode.Local;

    // I use image inside the report
    Rep_Local.LocalReport.EnableExternalImages = true;

    //// Set the report definition
    Rep_Local.LocalReport.ReportPath = Server.MapPath(String.Format("{0}.rdlc", "Print_Mit_Adr"));

    ReportDataSource rds = null;

    rds = new ReportDataSource(Rep_Local.LocalReport.GetDataSourceNames()[0], SqlDS_Standort.Select(DataSourceSelectArguments.Empty));

    ///SqlDS_Standort is a simple SqlDatasource with no DML Part; only select

    // check there is a valid report
    if (rds.Equals(null) == false)
    Rep_Local.LocalReport.DataSources.Add(rds);

    Rep_Local.LocalReport.Refresh();


    Thats all, and its rendering realy fast (Load data from Sql Server and the images from a directory on an IIS).


    This takes the pressure out of the project (i have a solution for my customer).

    But i take some time on weekend to handle RS (there are some new Connection properties 'IReportServerConnection' and 'IReportServerConnection2'; may be that's a way).

    So i don't give up (at the moment).

    Do you use this properties already or do you have hearded of the necessarity for serializeble credentials ??

    Patric
     
  12. Problem solved

    Hello,
    i posted my problem on the microsoft forum (http://social.msdn.microsoft.com/Fo...s/thread/bcc06f5d-0b5b-459f-8a0c-6112a8eeeec0) and they gave me a hint for the solution.

    I set the most parameter in the page_init event but also one parameter in the page_load event and that blocked the report-viewer and he wait for the next ajax postback (which not happen). So nothing in page_Load and all in page_init and i am ready for the next steps (meaning ReportingServices answer and show the report).
     
  13. mjp

    mjp

    Nice, glad you got it working.
     
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