By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,531 Members | 2,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,531 IT Pros & Developers. It's quick & easy.

Integrate Reports in ASP.Net Web Form

P: n/a
Hi,

I have my reports at http:\\localhost\ReportServer and need to use them in
ASP.NET Web Form.I have a few questions reg. this

------> I want to generate a PDF when a button labeled "Generate Report" is
clicked"

(1) I tried this using the below code:

Dim myResponse As Byte()
Dim url As String = http://localhost/reportserver?/Reports/Sales
Invoice&ORDER_ID=1879&rs:Format=PDF
Dim myWebClient As New WebClient
myWebClient.Credentials = CredentialCache.DefaultCredentials
myResponse = myWebClient.DownloadData(url)
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment; filename=Sales
Invoice.PDF")
Response.BinaryWrite(myResponse)

But got the error "The remote server returned an error: (403) Forbidden"
I have included "<identity impersonate="true"/>" in Web.Config File.
This Error is because the Credentials is null. I don't know why the
credentials are null even after I use myWebClient.Credentials =
CredentialCache.DefaultCredentials

The same code works if I Create new Credentials specifying UserName and
Password. But I am cannot specify Username and password. The Application has
take the credentials from the server.

(2) Why can't I use the following one line of code(This works, I want to
know are there any kind issues with
this)Response.Redirect(http://localhost/reportserver?/Reports/Sales
Invoice&ORDER_ID=1879&rs:Format=PDF)

(3) What are other ways to integrate reports with ASP.NET Web Form.

(4)I need to deploy the Reports that I created in my machine to the server
I tried to deploy setting TargetServerURL=http://servername/ReportServer in
Project Properties, but got the error
"The permissions granted to user are insufficient for performing this
operation". What kind of permissions are required.

(5)What are different ways to deploy Reports on a Server.
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Kiran:

1) Are you allowing anonymous users into the site? What do the
authentication and authorization sections of your web.config look
like? The web application will have to authenticate the user first in
order to properly impersonate with thier credentials.

2) This is the easiest way to integrate with SSRS, it's a perfectly
acceptable solution and is one of the scenarios the product was
designed for.

3) There is a web serivce API to interface with the report server
programatically. With web service calls you can render reports,
retrieve report parameters, essenitally anything the Report Manager UI
can do.
See this article for some examples, and there are other examples on
the site:
http://odetocode.com/Articles/95.aspx

4) You have to be at least in the Content Manager role. By default
only the report server local administrators group is in a role, you'll
probably have to add your domain account. More information here:
http://odetocode.com/Articles/215.aspx

5) There are at least three options. One is to deploy from Visual
Studio. Another is to upload the reports manually (yuck). Finally, you
can write an rss script. In fact, there is an example rss script
deployed with SSRS (if you installed the samples) that show how to
programatically deploy a report (it uses the web service API I talked
about in answer #1). These are executed weith the RS.exe utility.
See:
http://msdn.microsoft.com/library/de...rs_v1_5fxe.asp

Hope this helps,

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 21 Dec 2004 16:01:29 -0000, "Kiran" <Ki***@nospam.net> wrote:
Hi,

I have my reports at http:\\localhost\ReportServer and need to use them in
ASP.NET Web Form.I have a few questions reg. this

------> I want to generate a PDF when a button labeled "Generate Report" is
clicked"

(1) I tried this using the below code:

Dim myResponse As Byte()
Dim url As String = http://localhost/reportserver?/Reports/Sales
Invoice&ORDER_ID=1879&rs:Format=PDF
Dim myWebClient As New WebClient
myWebClient.Credentials = CredentialCache.DefaultCredentials
myResponse = myWebClient.DownloadData(url)
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment; filename=Sales
Invoice.PDF")
Response.BinaryWrite(myResponse)

But got the error "The remote server returned an error: (403) Forbidden"
I have included "<identity impersonate="true"/>" in Web.Config File.
This Error is because the Credentials is null. I don't know why the
credentials are null even after I use myWebClient.Credentials =
CredentialCache.DefaultCredentials

The same code works if I Create new Credentials specifying UserName and
Password. But I am cannot specify Username and password. The Application has
take the credentials from the server.

(2) Why can't I use the following one line of code(This works, I want to
know are there any kind issues with
this)Response.Redirect(http://localhost/reportserver?/Reports/Sales
Invoice&ORDER_ID=1879&rs:Format=PDF)

(3) What are other ways to integrate reports with ASP.NET Web Form.

(4)I need to deploy the Reports that I created in my machine to the server
I tried to deploy setting TargetServerURL=http://servername/ReportServer in
Project Properties, but got the error
"The permissions granted to user are insufficient for performing this
operation". What kind of permissions are required.

(5)What are different ways to deploy Reports on a Server.


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.