# ASP.NET WebViewer Application

ActiveReports provides you the WebViewer where you can view your report output in various types of viewers and provides key features of each viewer type.

## Content



You can use the ASP.NET WebForms Viewer control with .NET Framework 4.7.2 - 4.8.1. only.

The WebViewer control allows you to quickly display reports in Web applications. Once you drop the control onto a Web Form, you can look in the Visual Studio Properties grid and select the **ViewerType** that you want to use.

The WebViewer control supports the following types:

*   **HTMLViewer** (default): Provides a scrollable view of a single page of the report at a time. Downloads only HTML and java script to the client browser. Not recommended for printable output.
*   **RawHTML**: Shows all pages in the report document as one continuous HTML page. Provides a static view of the entire report document, and generally printable output, although under some circumstances pagination is not preserved.
*   **AcrobatReader**: Returns output as a PDF document viewable in Acrobat Reader.<br />_Client requirements:_ Adobe Acrobat Reader

In a WebViewer, an RDLX report can be rendered in two modes - Paginated and Galley. Using galley mode, you can view the contents of the RDLX report in a single and scrollable page. You can set Galley mode through UI of the WebViewer or through code by setting **RenderMode** property to **Galley**.<br /><br />You should use the [ReportName](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Web/GrapeCity.ActiveReports.Web.WebViewer.html) property to specify a report for the viewer to display. Also, you must add the **api/reporting/\* HTTP handler** to your 'web.config' file and corresponding **UseReporting** call to 'Global.asax' for this ViewerType to work properly.


> type=note
> **Note**: The WebViewer and JSViewer are supported only in the **Integrated pipeline mode**. You will get PlatformNotSupportedException on using these Viewers in Classic pipeline mode.

## Use the WebViewer control

1.  In Visual Studio, create a new ASP.NET Web Forms Application.
2.  Go to **Tools > NuGet Package Manager > Manage** **NuGet Packages for Solution...**, browse the following packages, and click **Install**:
    *   MESCIUS.ActiveReports.Web
    *   MESCIUS.ActiveReports.Web.Design/MESCIUS.ActiveReports.Web.Design.VS2022 (corresponding to the Visual Studio version you are using)
3.  In Solution Explorer, right-click the project and select **Add > New Item**.
4.  Select WebForm and click **Add**.
5.  Go to the **Design** tab of the newly added WebForm and drag and drop the WebViewer control to the WebForm designer. 
	> type=note
	> **Note**: If you get an error on adding the WebViewer control, you should install or upgrade the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package. See [Troubleshooting](/activereportsnet/docs/v19.2/ar-troubleshooting) for details.

## Preview Code-Based Section Reports in WebViewer control

You need to update the **Global.asax** file as follows, assuming that you have added 'SectionReport1.cs' in the project's root:

```csharp
public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            this.UseReporting(settings =>
            {
                settings.UseFileStore(new DirectoryInfo(Server.MapPath("~")));
                settings.UseCompression = true;
                settings.UseCustomStore(GetReport);
            });
        }
        public object GetReport(string reportName = "SectionReport")
        {
            SectionReport1 rpt = new SectionReport1();
            return rpt;
        }
    }
```

```vbnet
Public Class _Global
    Inherits System.Web.HttpApplication
    Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        Me.UseReporting(Sub(settings)
                            settings.UseFileStore(New DirectoryInfo(Server.MapPath("~")))
                            settings.UseCompression = True
                            settings.UseCustomStore(AddressOf GetReport)
                        End Sub)
    End Sub
    Public Function GetReport(ByVal Optional reportName As String = "SectionReport") As Object
        Dim rpt As SectionReport1 = New SectionReport1()
        Return rpt
    End Function
End Class
```

> type=note
> **Note**: Instead of ‘UseEmbeddedTemplates', you can use either 'UseFileStore' or 'UseCustomStore’ method calls.
> 
> *   'UseEmbeddedTemplates' stores reports as resources in dlls.
> *   'UseFileStore' stores reports in the file system.
> *   'UseCustomStore’ allows you to store reports in any user-defined location, like a custom database or any other type of location.

## See Also

#### Reference

[WebViewer Class](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Web/GrapeCity.ActiveReports.Web.WebViewer.html)
