Can I Response.Redirect to a pdf file on my c: drive?

Discussion in 'ASP .Net' started by Dave, Dec 15, 2004.

  1. Dave

    Dave Guest

    I have a Crystal reports export that throws the exported pdf file into a
    folder c:\reports. The export works fine, but now I need to redirect the
    user to that report. Can you please tell me how I can do that?

    Thanks,

    -Dave
    Dave, Dec 15, 2004
    #1
    1. Advertising

  2. Dave

    Shiva Guest

    http://support.microsoft.com/kb/307603/EN-US/

    Hope this helps.

    "Dave" <> wrote in message
    news:#...
    I have a Crystal reports export that throws the exported pdf file into a
    folder c:\reports. The export works fine, but now I need to redirect the
    user to that report. Can you please tell me how I can do that?

    Thanks,

    -Dave
    Shiva, Dec 15, 2004
    #2
    1. Advertising

  3. This code works perfectly for me:



    Response.ContentType="application/pdf";

    Response.AddHeader( "content-disposition","attachment; filename=filename);

    FileStream sourceFile = new FileStream("C:\\PDFs\\" + filename,
    FileMode.Open);

    long FileSize;

    FileSize = sourceFile.Length;

    byte[] getContent = new byte[(int)FileSize];

    sourceFile.Read(getContent, 0, (int)sourceFile.Length);

    sourceFile.Close();

    Response.BinaryWrite(getContent);

    -IFS

    "Dave" <> wrote in message
    news:%...
    >I have a Crystal reports export that throws the exported pdf file into a
    >folder c:\reports. The export works fine, but now I need to redirect the
    >user to that report. Can you please tell me how I can do that?
    >
    > Thanks,
    >
    > -Dave
    >
    Isaias Formacio-Serna, Dec 15, 2004
    #3
    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. Jon
    Replies:
    5
    Views:
    11,158
    Scott M.
    Jan 17, 2010
  2. mh
    Replies:
    4
    Views:
    700
    Wolfgang Strobl
    May 31, 2005
  3. shailesh
    Replies:
    1
    Views:
    780
    Tim Golden
    Mar 28, 2007
  4. Sal
    Replies:
    1
    Views:
    406
  5. Ricardo Pog
    Replies:
    1
    Views:
    420
    Austin Ziegler
    Mar 26, 2008
Loading...

Share This Page