Hi everybody. I'm new in ASP.NET. Help me anybody, please. Thanks!
I'm trying to open a PDf file. I did like this:
Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("content-disposition", "filename" + e.CommandArgs.CommandArgument);
Response.TransmitFile(Server.MapPath("~/Data/") + e.CommandArgs.CommandArgument);
Response.End();
Or like this:
string path = Server.MapPath("~/Data/") + e.CommandArgs.CommandArgument;
WebClient client = new WebClient();
Byte[] buffer = client.DownloadData(path);
if (buffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", buffer.Length.ToString());
Response.BinaryWrite(buffer);
}
// in e.CommandArgs.CommandA ...
Go to the complete details ...