I am trying to use the render webmothod to render the report in PDF..I have
forms based authentication in place. The follwoing code is mainly to get rid
of open save dialog box when the report is running in a webbrowser.
The follwing is the code:
===================================================== 'specify the credentials
Dim s As RS.ReportingService = New RS.ReportingService
s.Credentials = System.Net.CredentialCache.DefaultCredentials
Try
' Render arguments
Dim result As Byte() = Nothing
' Please adapt report name and path
Dim reportPath As String = "/SKEL REPORTS/UserList"
Dim format As String = "PDF"
Dim historyID As String = Nothing
Dim devInfo As String = ""
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As RS.Warning() = Nothing
Dim reportHistoryParameters As RS.ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim sh As RS.SessionHeader = New RS.SessionHeader
s.SessionHeaderValue = sh
'call the render method of webservice
result = s.Render(reportPath, format, historyID, devInfo, Nothing,
Nothing, showHideToggle, encoding, mimeType, reportHistoryParameters,
warnings, streamIDs)
'send the PDF report to IE using Response object
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "inline;
filename=report1.PDF")
Response.BinaryWrite(result)
Response.End()
'Response.Write ("done");
Catch ex As Exception
Response.Write(ex.ToString())
End Try
End Sub
===================================================== This is the error I get when I try to run a report:
===================================================== System.Net.WebException: The request failed with the error message: --
Object moved to here.
--. at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at RS.ReportingService.Render(String Report,
String Format, String HistoryID, String DeviceInfo, ParameterValue[]
Parameters, DataSourceCredentials[] Credentials, String ShowHideToggle,
String& Encoding, String& MimeType, ParameterValue[]& ParametersUsed,
Warning[]& Warnings, String[]& StreamIds) in c:\inetpub\wwwroot\skel\Web
References\RS\Reference.vb:line 549 at
EQ.SKEL.Web.WebForms.ReportViewer.RenderReport() in
c:\inetpub\wwwroot\skel\Reports\ReportViewer.aspx.vb:line 137
====================================================The "Object moved to here." is the Report Server trying to redirect you to
the login page. That means the forms auth cookie isn't getting transmitted
properly. Make sure your report server web service proxy is set up
correctly, and that you are calling the web site with the same servername
(FQDN recommended) as you have set up in the report server config files for
the report server. If they are different server names, the cookie won't be
recognized as coming from the same place.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"shahab" <shahab@.discussions.microsoft.com> wrote in message
news:90B97D80-FADB-4727-B71E-A9BF0D110530@.microsoft.com...
>I am trying to use the render webmothod to render the report in PDF..I have
> forms based authentication in place. The follwoing code is mainly to get
> rid
> of open save dialog box when the report is running in a webbrowser.
> The follwing is the code:
> =====================================================> 'specify the credentials
> Dim s As RS.ReportingService = New RS.ReportingService
> s.Credentials = System.Net.CredentialCache.DefaultCredentials
> Try
> ' Render arguments
> Dim result As Byte() = Nothing
> ' Please adapt report name and path
> Dim reportPath As String = "/SKEL REPORTS/UserList"
> Dim format As String = "PDF"
> Dim historyID As String = Nothing
> Dim devInfo As String = ""
> Dim showHideToggle As String = Nothing
> Dim encoding As String
> Dim mimeType As String
> Dim warnings As RS.Warning() = Nothing
> Dim reportHistoryParameters As RS.ParameterValue() = Nothing
> Dim streamIDs As String() = Nothing
> Dim sh As RS.SessionHeader = New RS.SessionHeader
> s.SessionHeaderValue = sh
> 'call the render method of webservice
> result = s.Render(reportPath, format, historyID, devInfo, Nothing,
> Nothing, showHideToggle, encoding, mimeType, reportHistoryParameters,
> warnings, streamIDs)
> 'send the PDF report to IE using Response object
> Response.ClearContent()
> Response.ContentType = "application/pdf"
> Response.AddHeader("content-disposition", "inline;
> filename=report1.PDF")
> Response.BinaryWrite(result)
> Response.End()
>
> 'Response.Write ("done");
> Catch ex As Exception
> Response.Write(ex.ToString())
> End Try
> End Sub
> =====================================================> This is the error I get when I try to run a report:
> =====================================================> System.Net.WebException: The request failed with the error message: --
> Object moved to here.
> --. at
> System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
> message, WebResponse response, Stream responseStream, Boolean asyncCall)
> at
> System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
> methodName, Object[] parameters) at RS.ReportingService.Render(String
> Report,
> String Format, String HistoryID, String DeviceInfo, ParameterValue[]
> Parameters, DataSourceCredentials[] Credentials, String ShowHideToggle,
> String& Encoding, String& MimeType, ParameterValue[]& ParametersUsed,
> Warning[]& Warnings, String[]& StreamIds) in c:\inetpub\wwwroot\skel\Web
> References\RS\Reference.vb:line 549 at
> EQ.SKEL.Web.WebForms.ReportViewer.RenderReport() in
> c:\inetpub\wwwroot\skel\Reports\ReportViewer.aspx.vb:line 137
> ====================================================|||Thank you I got it working, the problem was I converted the code to VB.net
and authcookie got confused with the local variable, hence the cookie was
never being passed around.
"Jeff A. Stucker" wrote:
> The "Object moved to here." is the Report Server trying to redirect you to
> the login page. That means the forms auth cookie isn't getting transmitted
> properly. Make sure your report server web service proxy is set up
> correctly, and that you are calling the web site with the same servername
> (FQDN recommended) as you have set up in the report server config files for
> the report server. If they are different server names, the cookie won't be
> recognized as coming from the same place.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "shahab" <shahab@.discussions.microsoft.com> wrote in message
> news:90B97D80-FADB-4727-B71E-A9BF0D110530@.microsoft.com...
> >I am trying to use the render webmothod to render the report in PDF..I have
> > forms based authentication in place. The follwoing code is mainly to get
> > rid
> > of open save dialog box when the report is running in a webbrowser.
> > The follwing is the code:
> > =====================================================> > 'specify the credentials
> > Dim s As RS.ReportingService = New RS.ReportingService
> > s.Credentials = System.Net.CredentialCache.DefaultCredentials
> >
> > Try
> >
> > ' Render arguments
> > Dim result As Byte() = Nothing
> > ' Please adapt report name and path
> > Dim reportPath As String = "/SKEL REPORTS/UserList"
> > Dim format As String = "PDF"
> > Dim historyID As String = Nothing
> > Dim devInfo As String = ""
> >
> > Dim showHideToggle As String = Nothing
> > Dim encoding As String
> > Dim mimeType As String
> > Dim warnings As RS.Warning() = Nothing
> > Dim reportHistoryParameters As RS.ParameterValue() = Nothing
> > Dim streamIDs As String() = Nothing
> > Dim sh As RS.SessionHeader = New RS.SessionHeader
> > s.SessionHeaderValue = sh
> >
> > 'call the render method of webservice
> > result = s.Render(reportPath, format, historyID, devInfo, Nothing,
> > Nothing, showHideToggle, encoding, mimeType, reportHistoryParameters,
> > warnings, streamIDs)
> >
> > 'send the PDF report to IE using Response object
> > Response.ClearContent()
> > Response.ContentType = "application/pdf"
> > Response.AddHeader("content-disposition", "inline;
> > filename=report1.PDF")
> > Response.BinaryWrite(result)
> > Response.End()
> >
> >
> > 'Response.Write ("done");
> > Catch ex As Exception
> > Response.Write(ex.ToString())
> > End Try
> >
> > End Sub
> > =====================================================> > This is the error I get when I try to run a report:
> > =====================================================> > System.Net.WebException: The request failed with the error message: --
> > Object moved to here.
> > --. at
> > System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
> > message, WebResponse response, Stream responseStream, Boolean asyncCall)
> > at
> > System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
> > methodName, Object[] parameters) at RS.ReportingService.Render(String
> > Report,
> > String Format, String HistoryID, String DeviceInfo, ParameterValue[]
> > Parameters, DataSourceCredentials[] Credentials, String ShowHideToggle,
> > String& Encoding, String& MimeType, ParameterValue[]& ParametersUsed,
> > Warning[]& Warnings, String[]& StreamIds) in c:\inetpub\wwwroot\skel\Web
> > References\RS\Reference.vb:line 549 at
> > EQ.SKEL.Web.WebForms.ReportViewer.RenderReport() in
> > c:\inetpub\wwwroot\skel\Reports\ReportViewer.aspx.vb:line 137
> > ====================================================>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment