About downloading file
-
Hi, I am using this code for downloading a file.Can anybody tell how to use it without showing save as option:- Response.ContentType = "text/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + ViewState["Name"].ToString() + ".pdf"); Thread.Sleep(5000); Response.TransmitFile(sfilepath); Response.End(); Thanks
-
Hi, I am using this code for downloading a file.Can anybody tell how to use it without showing save as option:- Response.ContentType = "text/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + ViewState["Name"].ToString() + ".pdf"); Thread.Sleep(5000); Response.TransmitFile(sfilepath); Response.End(); Thanks
tauras81 wrote:
without showing save as option:-
That is not possible as it is controlled by the browser.
Navaneeth How to use google | Ask smart questions
-
Hi, I am using this code for downloading a file.Can anybody tell how to use it without showing save as option:- Response.ContentType = "text/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + ViewState["Name"].ToString() + ".pdf"); Thread.Sleep(5000); Response.TransmitFile(sfilepath); Response.End(); Thanks
Hello, u can try out with DownloadFile() method. for this u need to include namspace System.Net then u can try out as WebClient objWebClient = new WebClient(); objWebClient.DownloadFile(URI, targetfilename); Check this hope it helps Regards, ashok
ashok
-
Hello, u can try out with DownloadFile() method. for this u need to include namspace System.Net then u can try out as WebClient objWebClient = new WebClient(); objWebClient.DownloadFile(URI, targetfilename); Check this hope it helps Regards, ashok
ashok
I think the above solution will solve your problem only when you are using this in a windows application.where webclient will act as intermediate browser and handle the request and target filename will be obviously a local path in your system to which you will be having access. :) But if the requirement is like you have to host the webapp in a remote server and the you are accessing this website from a different client machine, there would be no choice and will be entirely controlled by the browser which you use :(
Shyam my blog dotnetscoups.blogspot.com . swthoughts.blogspot.com .