This is quite easy with custom programming, I've made a new webapp and gave the aspnet-user full access to reporting services, maybe you could add a cutom file to the Reports-Webapp..
I've default.aspx:
<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%
 Dim pdfloader As New PDFLoader(Request, Response)
 pdfloader.show()
%>
and default.aspx.vb:
Public Class PDFLoader
 Private request As System.Web.HttpRequest
 Private response As System.Web.HttpResponse
 Public Sub New(ByVal request As System.Web.HttpRequest, ByVal response As System.Web.HttpResponse)
 Me.request = request
 Me.response = response
 End Sub
 Public Sub show()
 Dim rsExec As New ReportExecutionService
 rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials
 ' Prepare Render arguments
 Dim historyID As String = Nothing
 Dim deviceInfo As String = Nothing
 Dim format As String = "PDF"
 Dim showHide As String = Nothing
 Dim results() As [Byte]
 Dim warnings As RepExServ.Warning() = Nothing
 Dim streamIDs As String() = Nothing
 Dim encoding As String = String.Empty
 Dim mimeType As String = String.Empty
 Dim reportName As String
 Dim zaehl As Integer = -1
 Dim names(), name, values(), value As String
 Dim ParameterValues() As RepExServ.ParameterValue
 ParameterValues = New RepExServ.ParameterValue(0) {}
 names = request.QueryString.AllKeys
 For Each name In names
 values = request.QueryString.GetValues(name)
 For Each value In values
 If (name = "") Then
 reportName = value
 Else
 zaehl = zaehl + 1
 If zaehl >= ParameterValues.Length Then
 ReDim Preserve ParameterValues(zaehl)
 End If
 Dim ParameterValue As RepExServ.ParameterValue = New RepExServ.ParameterValue
 ParameterValue.Name = name
 ParameterValue.Value = value
 ParameterValue.Label = Nothing
 ParameterValues(zaehl) = ParameterValue
 End If
Next
Next
 Dim ei As ExecutionInfo = rsExec.LoadReport(reportName, historyID)
 If zaehl > -1 Then
 rsExec.SetExecutionParameters(ParameterValues, "")
 End If
 'Exectute the report and send it to the Client
 results = rsExec.Render(format, deviceInfo, "", encoding, mimeType, warnings, streamIDs)
 response.ContentType = "application/pdf"
 response.BinaryWrite(results)
 End Sub
End Class
Partial Class _Default
 Inherits System.Web.UI.Page
End Class
This works just similar to the usual URL-Access method, but you can't specify any "rs:" - Parameters.. sampe call:
http://yourserver/YourWebApp/default.aspx?/RepPath/Repname&Parameter1=something
okay, I forgot something: you have to add WebReferences to you webapp:
http://msdn2.microsoft.com/en-us/library/ms154699(SQL.90).aspx
I also would like to open my report in PDF format without opening the Open/Save Dialog box.
I read that the ExportContentDisposition is indeed the property to use.
Is there a way to put this property in the URL when calling the report? Or do I have to use the ReportViewer Control? I am using SQL Server Reporting with ASP, not ASP.net
Thx
|||You can always mimic the approach given above of hainvg a custom page that does the export, just recode it in ASP, rather than ASP.NET.
Hope that helps,
-Lukasz
|||I have just tried creating the web app posted by BenniG and it works great on my computer but when I try from any of my co-workers computers i get a scripting error stating invalid character on line 2 character 1.
I know this is pretty vague but then again so is the error.
Any thoughts?
 
No comments:
Post a Comment