Groups | Blog | Home
all groups > dotnet academic > november 2003 >

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


JA
11/3/2003 3:17:09 AM
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
Peter van der Goes
11/3/2003 7:58:35 AM

[quoted text, click to view]

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]

Peter van der Goes
11/3/2003 8:44:43 AM

[quoted text, click to view]

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]



AddThis Social Bookmark Button