How to Integrate URL Access in an Application


You can use URL Access to incorporate reports into Windows and web applications.

Several methods are available for web applications. The most common method is to use a URL Access command string as a source or IFRAME. In a simple case scenario, this could be an HTML file with the following code:

 <IFRAME           NAME="Frame1" SRC="http://localhost/ReportServer?/Samples/SimpleReport&          rc:Toolbar=false&rc:LinkTarget= Frame1", width = 50%, height = 50%>   </IFRAME> 

The preceding code creates a frame on the page that is located in the upper-left corner and takes 50% of the page's "real estate." The frame changes size as the browser window changes size . The purpose of &rc:LinkTarget= Frame1 is to make sure that all of the report's navigation happens inside of the frame called Frame1 .

You can also add a link to a report in a web application or leverage the rc:HTMLFragment parameter.

You can also call SSRS web services to obtain needed information and then incorporate the returned stream into the application's HTML stream. More details on working with SSRS web service can be found in Chapter 25, "How to Use Reporting Services Web Services."

URL Access methods for web applications described above, such as using URL Access command as a source for IFRAME, have a common downside. They all use the HTTP GET method, which is an equivalent to a form submission where METHOD="GET" .

There are a couple of potential issues with the GET method.

First, it might be easy to hack the URL string and make changes that would allow a malicious user to potentially get some proprietary information. A report's security restricts a user 's access to a whole report, but does not prevent someone from experimenting with the parameters of a report.

By contrast, when you use URL Access with METHOD="POST" , you can use hidden fields to prevent users from changing parameters used in URL Access.

Second, the URL GET request's length is limited to the maximum allowed by the browser. Some browsers have this limit as low as 256 characters .

Internet Explorer's maximum URL request length is 2,083 characters, with 2,048 maximum path length. This limit applies to both GET and POST methods. POST, however, is not affected by this limitation for submitting name/value pairs, because they are transferred in the header and not the URL.

For more details, see the following Microsoft Knowledge Base Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;208427.

Note

Limits on the length of POST requests can also be controlled by registry settings. For example in IIS 6.0, HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters subkeys MaxFieldLength and MaxRequestBytes control the size of the header and subkeys UrlSegmentMaxCount and UrlSegmentMaxCount control segmentation. A segment is a part of a URL string separated by "/" ( slashes ). See http://support.microsoft.com/default.aspx?scid=kb;en-us;820129 for more details.


Changing the GET method to the POST method is fairly easy; for example, the following URL Access GET method

 http://localhost/ReportServer?/Samples/SimpleReport&rs:Command=Render      &rc:LinkTarget=main&rs:Format=HTML4.0& EmployeeID=0947834 

can be translated to the following POST method:

 <FORM id="frmRender" action="http://localhost/ReportServer?/Samples/SimpleReport"  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="hidden" name="EmployeeID" value="0947834">        <INPUT type="submit" value="Button">   </FORM> 

To integrate URL Access in a Windows application, you can embed a web browser control in a Windows form. An old-style COM component from the Internet Controls Library ( shdocview.dll ) can be used with Visual Studio versions prior to VS2005.

VS2005 is sporting a new .NET web browser control. Simply drag and drop this control from the Visual Studio 2005 Toolbox on your Windows form, and then set the URL property of a control to a URL Access string. It's that simple.



Microsoft SQL Server 2005 Reporting Services
Microsoft SQL Server 2005 Reporting Services
ISBN: 0672327996
EAN: 2147483647
Year: 2004
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net