Hello,
I have a problem about disable the "Save as"(Ctrl+S) and "Print"(Ctrl+P) when right clicked on pdf web page.(for protect it not share with anyone,means only show it for information).
I have wrote a code as below.
[HttpGet]
public HttpResponse GetPdf(int id)
{
MyContext.File I = null;
if (id > 0)
I = (from p in File where p.ID == id select p).SingleOrDefault();
HttpResponseMessage R = null;
var context = HttpContext.Current;
if (I != null)
{
context.Response.Buffer = true;
context.Response.Charset = "";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentType = "application/pdf";
context.Response.AppendHeader("Content-Disposition", "inline; filename=" + I.NAME+ ";");
context.Response.BinaryWrite(I.DATA);
context.Response.Flush();
context.Response.End();
}
else
R = Request.CreateResponse(HttpStatusCode.BadRequest);
return context.Response;
}
If your tool can provide, could you please help us?
Thanks,
Regards.