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

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

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

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. Charles A. Lackman
    Replies:
    2
    Views:
    8,429
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    951
    Kevin Spencer
    Jul 17, 2003
  3. Sehboo
    Replies:
    3
    Views:
    9,467
    Sehboo
    Dec 10, 2003
  4. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,172
    Srowe1975
    Oct 15, 2008
  5. shailesh
    Replies:
    1
    Views:
    1,060
    Tim Golden
    Mar 28, 2007
  6. Sal
    Replies:
    1
    Views:
    1,671
  7. Ron Howard
    Replies:
    2
    Views:
    783
    Ron Howard
    Aug 11, 2004
  8. Ricardo Pog
    Replies:
    1
    Views:
    781
    Austin Ziegler
    Mar 26, 2008
Loading...