Integrate Reports in ASP.Net Web Form

Discussion in 'ASP .Net' started by Kiran, Dec 21, 2004.

  1. Kiran

    Kiran Guest

    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.
    Kiran, Dec 21, 2004
    #1
    1. Advertising

  2. Kiran

    Scott Allen Guest

    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,

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/


    On Tue, 21 Dec 2004 16:01:29 -0000, "Kiran" <> 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.
    >
    Scott Allen, Dec 21, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Barnes
    Replies:
    1
    Views:
    563
    J Jones
    Feb 18, 2004
  2. ASP .NET Newbie
    Replies:
    10
    Views:
    14,688
    jojobouy
    Sep 28, 2007
  3. =?Utf-8?B?c2Fua2FyYQ==?=
    Replies:
    0
    Views:
    401
    =?Utf-8?B?c2Fua2FyYQ==?=
    Jun 23, 2005
  4. Peri
    Replies:
    1
    Views:
    2,940
    =?Utf-8?B?Um90aGFyaWdlcg==?=
    Jul 21, 2005
  5. Rod
    Replies:
    2
    Views:
    1,770
Loading...

Share This Page