Welcome to MSDN Blogs Sign in | Join | Help

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="http://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.

Published Saturday, February 14, 2004 5:48 PM by bryanke
Filed under:

Comments

# re: Accessing a Report Server Using a URL POST Request

Monday, February 23, 2004 11:19 AM by kyle
how can you pass the windows user name in this post statement to view/render this report?

# re: Accessing a Report Server Using a URL POST Request

Monday, February 23, 2004 11:23 AM by Bryan Keller
Hi Kyle,

You cannot pass report server usernames and passwords via a URL, only data source usernames and passwords. The authentication method of the report server determines usernames and passwords (integrated, Basic over SSL, etc.) but you will still get prompted for username and password for the server. There is a sample coming out in a few weeks that will show you how to use Forms authentication with Reporting Services, but the limitation still remains that you cannot pass report server usernames and passwords using URL access.

# re: Accessing a Report Server Using a URL POST Request

Monday, February 23, 2004 7:17 PM by kyle
Thanks, for the comments bryan! :) That would be a great example. We are struggling with finding out a way to access the reports without the dialog popping up and still keeping things secure.

# Accessing a Report Server Using a URL POST Request

Thursday, February 26, 2004 12:53 AM by Enjoy Every Report

# re: Accessing a Report Server Using a URL POST Request

Friday, April 02, 2004 7:57 AM by Bret
Bryan,

Is there a way to tell Reporting Services to ignore extra parameters passed via the POST? I have some other controls on the page which are causing problems when I post to the report page. The error is :"An attempt was made to set a report parameter 'URL' that is not defined in this report. (rsUnknownReportParameter) Get Online Help"

Thanks,

Bret

# re: Accessing a Report Server Using a URL POST Request

Friday, April 02, 2004 8:14 AM by Bryan Keller
Not really. You would have to prefix them with a custom identifier, so that the report server would not interpret them as report parameters.

# re: Accessing a Report Server Using a URL POST Request

Monday, April 05, 2004 12:22 PM by Bret
Bryan,

Thanks for your response. I fixed my previous problem, but not I am running into an issue with RS any time the length of the url and parameters combination are greater than 1495 characters. It brings up the report page and sits on the "Report is being generated" screen forever (I have yet to see it do anything past that). It happens when I pass the parameters with both the URL and POST. Any ideas?

Thanks,

Bret

# re: Accessing a Report Server Using a URL POST Request

Monday, April 26, 2004 8:30 AM by Chris
Hi Bryan,

Can you explain how we can do 'single sign on' with forms authentication (which we have working)? We currently have an ASP.NET application that uses Forms auth, within which we make calls to the RS webservice - which necessitates a call to the 'LogonUser(username, password)' method. What we want to try to avoid popping up the logon screen a second time, and we also want to avoid storing the user's password in his session.

Thanks,

Chris

# re: Accessing a Report Server Using a URL POST Request

Monday, April 26, 2004 8:33 AM by Bryan Keller
You don't really have to call LogonUser. If you have already authenticated your users through some other system, you simply have to add our cookie and HTTP header to the request and response headers. I would recommend posting this question to our public newsgroup

Microsoft.Public.SQLServer.ReportingSvcs

# re: Accessing a Report Server Using a URL POST Request

Tuesday, April 27, 2004 6:07 AM by Raj Chidipudi
THanks for the tip Bryan.

But don't really know how to "add our cookie and HTTP header to the request and response headers".

It would be really helpful if you can provide some sample code for accomplishing the above task.

Regards
Raj Chidipudi

# re: Accessing a Report Server Using a URL POST Request

Thursday, May 13, 2004 2:27 PM by Tammy
Hi Brian,

Did you have a response to Bret's post on 4/5? I am concerned with the same issue... having too long of a URL...

Thanks!

# re: Accessing a Report Server Using a URL POST Request

Tuesday, May 18, 2004 1:11 PM by Shawn
"you simply have to add our cookie and HTTP header to the request and response headers"

What header and cookie?

# re: Accessing a Report Server Using a URL POST Request

Thursday, June 10, 2004 7:09 AM by Thomas Hansen
Hi

I want to execute a report using an URL request and the output must be delivered as a PDF-file. That's no problem - BUT then user has to name and save the PDF-file. I would be wery useful if the name and the directory of the output file could be set directly in the URL-Request.

Thanks!

# Web Application/data source username/password

Saturday, June 19, 2004 6:27 AM by Arron
My application is a web application and use post request, if I put data source username/password on a form hidden variable then any one can see it by view source , how to avoid that and make it secure?

Thanks!

# re: Accessing a Report Server Using a URL POST Request

Wednesday, June 23, 2004 3:52 AM by Eralper Yılmaz
Hi Bryan,

Great site on Reporting Services. Thanks...

I want to use hidden parameters after the service patch. But could not find any sample about using hidden parameters.

# re: Accessing a Report Server Using a URL POST Request

Wednesday, June 23, 2004 9:47 AM by Bryan Keller
Hi Eralper,

Report Designer is not my specialty, but I believe that if you clear the prompt string on the parameters page, that will make the parameter hidden. There should be something on it in the SP1 readme.

# re: Accessing a Report Server Using a URL POST Request

Wednesday, June 23, 2004 12:46 PM by Alex
Hi Brian

How can I make report server working use Netscape? By default, it seems only work for IE.

# re: Accessing a Report Server Using a URL POST Request

Thursday, June 24, 2004 6:56 AM by Lee

If I use URL access, choice Excel as the fromat, I will be asked "Would you liek to open the file or save it to yoour computer?" twice.

When I was asked 1st time, I click "Open", then I would be asked again. After the second time I had been asked, I clicked "Open" then it can be really opend? Anyone can point me out why? and how to avoid to be asked twice.

Thanks!

<HTML>
<BODY>
<FORM id="frmRender" action="http://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="EXCEL">
<INPUT type="hidden" name="rc:Parameters" value="False">
<INPUT type="text" name="SalesOrderNumber" value="SO5414">
<INPUT type="submit" value="View Report">
</FORM>
</BODY>
</HTML>

# re: Accessing a Report Server Using a URL POST Request

Wednesday, July 14, 2004 7:37 AM by Parvath Reddy
I am trying to use URL Access to get a page on to a frame and I am trying to write a toolbar for my own. Now I am able to use Section=1 in the &rc to go to first page, but is there a way to find the number of pages. so that I can use that to navigate the pages.
Thanks

# re: Accessing a Report Server Using a URL POST Request

Wednesday, July 14, 2004 9:48 AM by Bryan Keller
There is no real way to determine Section count or page number ahead of time. This was simply an oversight and we are looking for ways to add this in future versions. As for using section, it should work just fine. Here is a sample URL based on the report samples and it worked for me as expected:

http://servername/ReportServer?%2fSampleReports%2fProduct+Catalog&rs%3aCommand=Render&rc%3aSection=2&rc%3aDocMap=false&rc%3aToolbar=false

# Accessing a Report Server Using a URL Access

Wednesday, July 14, 2004 9:53 AM by Parvath Reddy
I am trying to use URL Access to get a page on to a frame and I am trying to write a toolbar of my own that simulates and does some extra functionality. Now I can use Section=1 in the &rc to go to first page, but is there a way to find the number of pages or access the javascript the original toolbar uses.
Thanks

# re: Accessing a Report Server Using a URL POST Request

Monday, July 19, 2004 3:08 AM by Rehan khan
Hi Bryan
This solution is not working for me
I have SQL Reporting Enterprise version with SP1
I followed all the steps which you told, but it did'nt work
Thanks

# re: Accessing a Report Server Using a URL POST Request

Monday, July 19, 2004 5:28 AM by Rehan khan
Hi Bryan

It is now working now but problem still what i facing is still the parameter are passed as a query string to report which i don't want.
Even if i am sedning parameter value using POST method but still values are going as a query string

Can you let me know what is the issue

Rehan

# re: Accessing a Report Server Using a URL POST Request

Monday, July 19, 2004 5:28 AM by Rehan khan
Hi Bryan

It is now working now but problem still what i facing is still the parameter are passed as a query string to report which i don't want.
Even if i am sedning parameter value using POST method but still values are going as a query string

Can you let me know what is the issue

Rehan

# re: Accessing a Report Server Using a URL POST Request

Thursday, August 05, 2004 12:23 AM by Susie
Hi,

I am also accessing reports using direct url access. Is there a way to avoid specifying the exact parameter name when passing values for the report parameter.
ex fname=&lname=&mname=

I am comparing it to crystal report where we just usually use prompt0=&prompt1=&prompt2= and the report will pass it to the parameters fname,lname,mname respectively.

This way, if we change the name of the parameter in the stored procedure, lets say, firstname instead of fname and so on, we don't have to change the page calling the report.

# Random SSRS nuggets from all over

Tuesday, April 25, 2006 9:22 AM by Russell Christopher's Semi-Useful BI Musings
[This will be a list of resources I point people to all the time....just putting 'em all in one place]...
Anonymous comments are disabled
 
Page view tracker