I am currently using a ASP.net Webservice to generate and downlaod PDF file to the clients computer.
Whats weird though is that instead of saving the file to the users computer download folder the Web Service saves the file to the IIS Server DefaultAppPool\Download folder on which the ASP.net web application is hosted onto.
This is my current folder which to generate folder paths
string status = "";
string filename = "File_"
string sourcepath = "";
string destinationpath = "";
string baseUrl = "http://serverPath/MyApp/";
filename = filename + "_" + DateTime.Now.ToLongTimeString().Replace(":", "-").Replace(".", "-") + ".pdf";
sourcepath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["_baseTempPDFPath"] + filename);
destinationpath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Downloads\\" + filename;
string DocContent = "";
This below line of code generate a wrong path which is not intended by me.
destinationpath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Downloads\\" + filename;
What i want is C:\Users\ProfileName\Downloads\
I want to save the dynamically generated PDF to this path.
OR Is there a way to download the PDF to users computer
I tried this code and it does not work
HttpContext.Current.Response.BinaryWrite(outPdfBuffer);
HttpContext.Current.Response.End();
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.SuppressContent = true;
HttpContext.Current.ApplicationInstance.CompleteRequest();
Any solutions
What I have tried:
I have pasted the code above which i am currently using in the Web Service. I am using EVOPDF to generate the PDF file.