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.
Comments
- Anonymous
February 23, 2004
how can you pass the windows user name in this post statement to view/render this report? - Anonymous
February 23, 2004
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. - Anonymous
February 23, 2004
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. - Anonymous
April 01, 2004
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 - Anonymous
April 02, 2004
Not really. You would have to prefix them with a custom identifier, so that the report server would not interpret them as report parameters. - Anonymous
April 05, 2004
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 - Anonymous
April 26, 2004
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 - Anonymous
April 26, 2004
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 - Anonymous
April 26, 2004
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 - Anonymous
May 13, 2004
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! - Anonymous
May 18, 2004
"you simply have to add our cookie and HTTP header to the request and response headers"
What header and cookie? - Anonymous
June 09, 2004
The comment has been removed - Anonymous
June 18, 2004
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! - Anonymous
June 22, 2004
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. - Anonymous
June 23, 2004
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. - Anonymous
June 23, 2004
Hi Brian
How can I make report server working use Netscape? By default, it seems only work for IE. - Anonymous
June 23, 2004
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> - Anonymous
July 13, 2004
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 - Anonymous
July 14, 2004
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 - Anonymous
July 14, 2004
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 - Anonymous
July 18, 2004
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 - Anonymous
July 18, 2004
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 - Anonymous
July 18, 2004
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 - Anonymous
August 04, 2004
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. - Anonymous
April 25, 2006
[This will be a list of resources I point people to all the time....just putting 'em all in one place]...