Click here to Skip to main content
12,890,954 members (57,631 online)
Rate this:
Please Sign up or sign in to vote.
I need to display uploaded files in new window or same window of browser on Linkbutton's click event.

I'm able to get path of file.

Whether file exists or not is already checked, but I'm not able to OPEN file.

Files are uploaded at Inetpub\wwwroot\
(i.e. C:\Inetpub\wwwroot\ApplicationFiles\Template\1.pdf)
File path is saved in database.

Thanks in Advance!
Posted 9-Apr-11 2:55am
Updated 9-Apr-11 3:10am
Dalek Dave433.3K
Dalek Dave 9-Apr-11 9:11am
Edited for Grammar and Readability.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This could be a difficult question to answer, depending on the approaches you have attempted.

Please provide the code so that it can be studied.
(Not a complete codedump!, Just the relevent area :) )

There should be no readily apparent reason why a PDF is not opening, (Unless perhaps there is no PDF reader loaded? I presume this is not the case)

Another approach is to not load a PDF at all, and let the user choose to save once he has loaded it to his browser (This is an approach I favour with my company's website).

Either way, code would allow us to provide a better, more suitable answer for you.


Mark up if helpful!
Dave Parth 11-Apr-11 0:22am
Can you please provide me code for the scenario you use. (let the user choose to save once he has loaded it to his browser)

I am doing this thing first time. So i don't have much idea of this. I know we can easily do this thing using anchor tag. But we want to use anchor.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


try this code to open pdf files in browser after uploading

Response.AddHeader("content-type", "application/pdf");

Here you've to mention the content type .

now all browsers supports pdf files to display directly

All the Best

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 28 Sep 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100