How to open file(doc or pdf) in browser for an event in code behind. - DOTNET

This is a discussion on How to open file(doc or pdf) in browser for an event in code behind. - DOTNET ; In one of our requirements for our project we have a screen which will display a list of file in a dropdown list and after selecting a file from the dropdown and clicking the submit button it must open the ...

+ Reply to Thread
Results 1 to 3 of 3

How to open file(doc or pdf) in browser for an event in code behind.

  1. Default How to open file(doc or pdf) in browser for an event in code behind.

    In one of our requirements for our project we have a
    screen which will display a list of file in a dropdown
    list and after selecting a file from the dropdown and
    clicking the submit button it must open the requested file
    in the browser. Types of files are .doc or .pdf.

    I trying to open the file in the click even of the button
    using the response.redirect. It is working well for .doc
    files, but the it is not working for pdf files, it says
    the file is damaged.

    The same file is working (file is opened in the browser)
    when i am writing the same code in the page load event of
    the page.

    how do i display the file. or is there some other method
    for the same.

  2. Default Re: How to open file(doc or pdf) in browser for an event in code behind.


    "JA" <anonymous@discussions.microsoft.com> wrote in message
    news:0b2201c3a1fc$05d0daf0$a601280a@phx.gbl...
    > In one of our requirements for our project we have a
    > screen which will display a list of file in a dropdown
    > list and after selecting a file from the dropdown and
    > clicking the submit button it must open the requested file
    > in the browser. Types of files are .doc or .pdf.
    >
    > I trying to open the file in the click even of the button
    > using the response.redirect. It is working well for .doc
    > files, but the it is not working for pdf files, it says
    > the file is damaged.
    >
    > The same file is working (file is opened in the browser)
    > when i am writing the same code in the page load event of
    > the page.
    >
    > how do i display the file. or is there some other method
    > for the same.


    Please tell us what type of project you are attempting and in which
    language?
    The next question would be: to what are you redirecting the response in the
    case of a .pdf file? In the case of a .doc file, does MS Word open?

    --
    Peter - [MVP - Academic]



  3. Default Re: How to open file(doc or pdf) in browser for an event in code behind.


    "JA" <anonymous@discussions.microsoft.com> wrote in message
    news:0b2201c3a1fc$05d0daf0$a601280a@phx.gbl...
    > In one of our requirements for our project we have a
    > screen which will display a list of file in a dropdown
    > list and after selecting a file from the dropdown and
    > clicking the submit button it must open the requested file
    > in the browser. Types of files are .doc or .pdf.
    >
    > I trying to open the file in the click even of the button
    > using the response.redirect. It is working well for .doc
    > files, but the it is not working for pdf files, it says
    > the file is damaged.
    >
    > The same file is working (file is opened in the browser)
    > when i am writing the same code in the page load event of
    > the page.
    >
    > how do i display the file. or is there some other method
    > for the same.


    Please excuse my previous. On rereading your subject line, I see this is an
    ASP.NET project.
    Can you provide more detail on the error message you are getting when you
    select a .pdf file?
    I just tried this:

    Response.Redirect(http://localhost/Redirect/3000.pdf)
    in a VB ASP.NET project to open a .pdf file placed in the project folder,
    and it's working as advertised. Are you sure you got the URL correct?

    Peter - [MVP - Academic]





+ Reply to Thread

Similar Threads

  1. Replies: 9
    Last Post: 11-16-2007, 05:36 PM
  2. Vim - open current file in web browser
    By Application Development in forum Editors
    Replies: 5
    Last Post: 10-22-2007, 07:53 PM
  3. Browser Close Event
    By Application Development in forum Javascript
    Replies: 4
    Last Post: 05-02-2007, 02:30 AM
  4. Open a new browser window while viewing a PDFin an existing browser window
    By Application Development in forum Adobe Acrobat
    Replies: 0
    Last Post: 01-22-2007, 10:02 AM
  5. Replies: 5
    Last Post: 10-06-2003, 01:08 PM