sachin londhe

sachin londhe

  • NA
  • 14
  • 1.3k

How to download file with read only in ASP .NET website?

Mar 2 2018 8:43 AM
I have a file present on server. The file on server is read-only. When I download the file from ASP .NET application to my local machine, the file has read and write access both. The original read-only attribute removed. I want to download the file read-only mode. Could you please suggest the proper solution for this problem. I have tried below solution. Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=MyFile.pdf"); Response.TransmitFile(Server.MapPath("~/Files/MyFile.pdf")); Response.End(); On server, this file has read-only attribute, but if I download using above code, the read-only attribute remove automatically in client location. I want to prevent file read-only after downloading. Please suggest some solution.

Answers (2)