session101
Member
- Joined
- May 10, 2006
- Messages
- 23
I have a web app that opens the appropriate application based on the file extension using Response.ContentType. When I open an xls file, I would like the file to be opened in read-only permissions with Excel. How would I do this?
Here is my existing code:
switch (file.Extension)
{
case ".pdf":
Response.ContentType = "application/pdf";
break;
case ".htm":
case ".html":
Response.ContentType = "text/html";
break;
case ".txt":
Response.ContentType = "text/plain";
break;
case ".doc":
Response.ContentType = "application/msword";
break;
case ".xls":
case ".csv":
Response.ContentType = "application/xls";
break;
default:
Response.ContentType = "application/unknown";
break;
}
Response.Flush();
Response.WriteFile(file.FullName);
Response.End();
TIA.
Here is my existing code:
switch (file.Extension)
{
case ".pdf":
Response.ContentType = "application/pdf";
break;
case ".htm":
case ".html":
Response.ContentType = "text/html";
break;
case ".txt":
Response.ContentType = "text/plain";
break;
case ".doc":
Response.ContentType = "application/msword";
break;
case ".xls":
case ".csv":
Response.ContentType = "application/xls";
break;
default:
Response.ContentType = "application/unknown";
break;
}
Response.Flush();
Response.WriteFile(file.FullName);
Response.End();
TIA.