download a file on a button click
-
Hi friends, Please help in opening a file using c# on a button click... I tried with link button by asigning the resolve url to the file path.. but i couldnt open it...
Regards, Sivaprasad
-
Hi friends, Please help in opening a file using c# on a button click... I tried with link button by asigning the resolve url to the file path.. but i couldnt open it...
Regards, Sivaprasad
-
Hi friends, Please help in opening a file using c# on a button click... I tried with link button by asigning the resolve url to the file path.. but i couldnt open it...
Regards, Sivaprasad
-
Hi friends, Please help in opening a file using c# on a button click... I tried with link button by asigning the resolve url to the file path.. but i couldnt open it...
Regards, Sivaprasad
Try this out, We can change the content type to open a file, This code will open document: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + sOrigFilename); Response.AddHeader("Content-Length", oFileInfo.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(sFullFilePath); Response.End(); This will used to open an excel file: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + "c:\\Test\\Test.xls"); Response.AddHeader("Content-Length", oFileInfo.Length.ToString()); Response.ContentType = "application/vnd.ms-excel"; Response.WriteFile("c:\\Test\\Test.xls"); Response.end Ram
-
i want to open a .html file
Regards, Sivaprasad
-
Try this out, We can change the content type to open a file, This code will open document: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + sOrigFilename); Response.AddHeader("Content-Length", oFileInfo.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(sFullFilePath); Response.End(); This will used to open an excel file: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + "c:\\Test\\Test.xls"); Response.AddHeader("Content-Length", oFileInfo.Length.ToString()); Response.ContentType = "application/vnd.ms-excel"; Response.WriteFile("c:\\Test\\Test.xls"); Response.end Ram
Thanks Ram...U r code will do ..but I want to know the exact content type which will help me to download a .html file I am using Response.ContentType="application/x-zip-compressed" and Response.ContentType="application/x-zip...But in both case i am not able to open it....
Regards, Sivaprasad