HighTechTalks DotNet Forums  

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

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss How to open file(doc or pdf) in browser for an event in code behind. in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
JA
 
Posts: n/a

Default How to open file(doc or pdf) in browser for an event in code behind. - 11-03-2003 , 06:17 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
for the same.

Reply With Quote
  #2  
Old   
Peter van der Goes
 
Posts: n/a

Default Re: How to open file(doc or pdf) in browser for an event in code behind. - 11-03-2003 , 08:58 AM







"JA" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
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]




Reply With Quote
  #3  
Old   
Peter van der Goes
 
Posts: n/a

Default Re: How to open file(doc or pdf) in browser for an event in code behind. - 11-03-2003 , 09:44 AM




"JA" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
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 With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.