The requested page is not available for the requested platform. You are viewing the content for Default platform.

Display Remotely Created Documents

This tutorial illustrates how to use ASPxDocumentViewer to publish a document the DevExpress Report and Dashboard Server or WCF report service generates remotely.

Note

See the Display Documents from the Report and Dashboard Server topic to learn how to show remotely generated reports in the HTML5 Document Viewer.

Create a Web Application

To get started with this tutorial, open an existing ASP.NET Web Application with a print preview or create a new one from scratch. Refer to the Add a Document Viewer to an ASP.NET WebForms Application tutorial to learn how to add a print preview to a Web application.

Publish a Document Generated by a WCF Report Service

The following steps are required to publish a document a WCF report service provides:

  1. Click the ASPxDocumentViewer control's smart tag. In the invoked actions list, click the Remote Report property's ellipsis button.

    Asp-Preview-Remote-Documet00

  2. In the invoked wizard's first step, select Report Service and click Next.

    asp-preview-remote-document-00

  3. Next, specify the URI for the report service the server-side application hosts, as well as the name of the remote report you wish to display in the document viewer. Click Next to proceed to the next step.

    asp-preview-remote-document-01

  4. Specify a name for the endpoint and click Finish to exit the wizard.

    asp-preview-remote-documet-00

Publish a Document Generated by a DevExpress Report and Dashboard Server

The following steps are required to publish a document a DevExpress Report and Dashboard Server provides:

  1. Click the ASPxDocumentViewer control's smart tag, and select Remote Report in the invoked actions list.

    Asp-Preview-Remote-Documet00

  2. In the invoked wizard's first step, select Report Server and click Next.

    asp-preview-remote-document-report-server-00

  3. Next, specify the Report and Dashboard Server address and choose the authentication type.

    asp-preview-remote-document-report-server-01

    If you selected the Report Server Authentication option, you need to specify the user credentials as well. The wizard uses the specified credentials to obtain the information required in later steps. Refer to the code sample at the end of this section to learn how to pass credentials to the Report and Dashboard Server at runtime.

    Click Next to proceed to the next step.

  4. In the following step, select a report to display in the Document Viewer from the list of available reports and click Next.

    asp-preview-remote-document-report-server-02

  5. Specify a name for the newly added endpoint and click Finish to exit the wizard.

    asp-preview-remote-document-report-server-03

Report Server Authentication

To pass user credentials when connecting to a Report and Dashboard Server at runtime, handle the DocumentViewerRemoteSourceSettings.RequestCredentials event of the object the ASPxDocumentViewer.SettingsRemoteSource property returns.

void SettingsRemoteSource_RequestCredentials(object sender, 
DevExpress.XtraReports.Web.DocumentViewer.WebAuthenticatorLoginEventArgs e) {
    e.Credential = new DevExpress.XtraReports.Web.DocumentViewer.WebCredential("username", "password");
    e.Handled = true;
}

Launch the Application and View the Result

The client-side print preview is now capable of obtaining documents created on the application's server side.

Run the application to preview the document and use the corresponding toolbar commands to print or export the previewed report.

Asp-Preview-Remote-Documet00