TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Load PDF on Browser in ASP.NET
Mukesh Kumar
Oct 07
2015
Code
1.6
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System.Net;
public
void
ViewPDF(
string
path)
{
string
FilePath = Server.MapPath(path);
WebClient User =
new
WebClient();
Byte[] FileBuffer = User.DownloadData(FilePath);
if
(FileBuffer !=
null
)
{
Response.ContentType =
"application/pdf"
;
Response.AddHeader(
"content-length"
, FileBuffer.Length.ToString());
Response.BinaryWrite(FileBuffer);
}
}
asp.net
ASP.NET
Load PDF on Browser