Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void btnview_Click(object sender, EventArgs e)
        {
            try
            {

                sample_rep();
                string FilePath = Server.MapPath("~") + "\\Customer_Pdf\\MWFTS_Quotation_" + quotationid.Text + ".pdf";
                System.IO.FileInfo TargetFile = new System.IO.FileInfo(FilePath);
                if (TargetFile.Exists)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + TargetFile.Name);
                    Response.AddHeader("Content-Length", TargetFile.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(TargetFile.FullName);
                }

            }
            catch (Exception exp)
            {
                WebFormMaster.WriteToErrorLog("", exp);
            }
        }





hi ,
i wrote above code under button , when i click on button .pdf file created in Customer_Pdf folder in my local system, but when i hosted at server it does not created file in that Customer_Pdf folder ..........
can any body suggests me why this was not working at hosting server
Posted
Comments
Member 10042721 5-Oct-13 6:38am    
i solved above question
thank u for all

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900