Integrate Reports in ASP.Net Web Form

K

Kiran

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.
 
S

Scott Allen

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/default.asp?url=/library/en-us/rsuiref/htm/cpu_rs_v1_5fxe.asp

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top