Accessing a Report Server Using a URL POST Request

You may have a need to access a report server, not through GET requests or standard browser access, but through POST requests. The times when you might need to use a POST request in your application are as follows: 

  • You need to build a custom user interface with your own toolbar, parameters area, report exporting features, etc. This is often the case when you want to support a control that enables multi-select parameters.
  • You have a parameter list that causes your URL access string to exceed your browser's character limit on GET requests (sometimes as little as 256 characters).
  • You have some other reason to use POST requests that I haven't considered.

The following is a very simple example of using a form post method in your Web application to access a report server. Simply copy the HTML source into two separate files as indicated below and deploy the files to a virtual directory on your report server. Then access the file default.htm.

toolbar.htm

Contains a toolbar that can be used to enter a parameter and view the Sales Order Detail report.

<HTML>
<BODY>
<FORM id="frmRender" action="https://localhost/reportserver?/SampleReports/Sales Order Detail"
method="post" target="Main">
<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="hidden" name="rc:Parameters" value="False">
<INPUT type="text" name="SalesOrderNumber" value="SO5414">
<INPUT type="submit" value="View Report">
</FORM>
</BODY>
</HTML>

default.htm

Provides two frames that can be used to host the toolbar and view the rendered report.

<HTML>
<BODY>
<IFRAME ID="Top" src="toolbar.htm" width=100% height=10% />
<IFRAME ID="Main" Name="Main" src="" width=100% height=90% />
</BODY>
</HTML>

Okay, I hope this simple example gives you some ideas to work with.