Reporting Services - Reporting Services Programming
Using URL Access from a Web Application

Using URL Access from a Web Application

URL access in Reporting Services is specifically designed to enable access to individual reports over a network. This type of access is best for integrating report viewing and navigation into a custom Web application. You can use the following integration scenarios with URL access and Web applications:

  • Address a URL to a specific report server from a Web site or portal.
  • Use a form POST method and pass query string parameters to a report server URL using form fields.

URL Access Through Direct Addressing

The most straightforward method of URL access is direct addressing: a user or application simply directs a URL address to a report server. The user or application can also supply parameters to the URL that can affect the appearance of the report or resource that is being accessed. A URL can target a report server through the address bar of a Web browser, or a URL can be the source of an IFrame that is part of a larger Web application or portal. You can include hyperlinks to reports on various Web pages of your portal, as well as target a specific frame for the report or open a new browser window in the process.

In the following example, the hyperlink targets a frame named "main", which might be different from the one that includes the hyperlink. The hyperlink might be part of Web portal.

<a href="http://server/reportserver?/SampleReports/Territory Sales Drilldown&rs:Command=Render&rc:LinkTarget=main" 
target="main">Click here for the Territory Sales Drilldown sample report</a>

In the previous example, the device information setting LinkTarget is passed with a value of "main" in the query string of the URL. This ensures that any drillthrough hyperlinks in the report also target the frame named "main".

For more information about device information settings, see Device Information Settings.

URL access through direct addressing is a straightforward approach to accessing the report server through a URL. However, URL access of this kind has its limitations. Although the HTTP specification does not limit the maximum number of characters in a URL address, many servers and browsers do. In some cases, a 256-character limit is imposed. To get around this limitation, you can use POST requests using form submission. With POST requests, the name/value pairs of the query string cannot be directly modified by a user. In addition, the name/value pairs of the query string are not part of the URL, thus enabling you to provide much longer and more complex parameter lists. For more information, see "URL Access Through a Form POST Method" later in this topic.

Note  Internet Explorer has a maximum URL length of 2,083 characters. This limit applies to both POST and GET request URLs. POST, however, is not limited by the size of the URL for submitting name/value pairs as part of a form, because they are transferred in the header and not the URL.

For an example of an IFrame that uses direct URL addressing to access a report server, see ReportViewer Sample ASP.NET Server Control

URL Access Through a Form POST Method

When a user requests data from a report server using URL addressing, the HTTP request uses the GET method. This is equivalent to any form submission where METHOD="GET". Moreover, the user typically sees the URL for the report server (for example, on the address line of the browser), so the user may be able to view or modify the actual URL query string (the part of the URL that follows the ? character). The user might also note the particular URL request and report server parameters for later use. In addition, URL requests or form submissions that use METHOD="GET" are limited by the maximum number of characters that a server or Web browser can process.

By contrast, with forms submission using METHOD="POST" and input fields, an application can make report server URL access requests that are more "hidden" from users and cannot be modified from the current form. In addition, the length of the URL for submitting name/value pairs as part of the form is unlimited, because the name/value pairs are transferred in the header and not the URL. The following sample HTML demonstrates the use of a form that you can use to target a report server with a specific URL and pass query string parameters as part of the form's input fields.

<FORM id="frmRender" action="http://server/reportserver?/SampleReports/Territory Sales Drilldown"
   method="post" target="_self">
   <INPUT type="hidden" name="rs:Command" value="Render"> 
   <INPUT type="hidden" name="rc:LinkTarget" value="main">
   <INPUT type="hidden" name="rs:Format" value="HTML4.0">
   <INPUT type="submit" value="Button">
</FORM>

In the previous example, if a user clicks the button on the form, the report server returns an HTML-rendered report targeted at the current frame. A comparable URL access string might look like the following:

http://server/reportserver?/SampleReports/Territory Sales Drilldown&rs:Command=Render&rc:LinkTarget=main&rs:Format=HTML4.0
See Also

Integrating Reporting Services into Applications

Integrating Reporting Services Using URL Access

Report Server URL Access from a Windows Application

URL Access

Page view tracker