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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Saurav Gurjar
1.3k
385
11.4k
how to hide print button when pdf is opened in browser using asp.net
Dec 3 2020 11:35 PM
protected void lnkView_Click(object sender, EventArgs e)
{
LinkButton lbkFile = (LinkButton)sender;
string FilePath = Server.MapPath("~/Uploads/Improvementdata/" + lbkFile.CommandArgument);
WebClient User = new WebClient();
Byte[] FileBuffer = User.DownloadData(FilePath);
if (FileBuffer != null)
{
string extn = Path.GetExtension(lbkFile.CommandArgument);
if (extn == ".jpg" || extn == ".png" || extn == ".JPG" || extn == ".jpg")
{
Response.ContentType = "image/jpeg";
Response.AddHeader("content-length", FileBuffer.Length.ToString());
Response.BinaryWrite(FileBuffer);
}
else
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", FileBuffer.Length.ToString());
Response.BinaryWrite(FileBuffer);
}
}
}
Reply
Answers (
1
)
How to load html page into the main page ?
asp.net core razor use of role in view