prabhu p

prabhu p

  • NA
  • 181
  • 114.4k

error : Access is denied

Nov 23 2016 9:24 AM
I trying download a excel file from path 
 
when i copy and paste path from variable "savepath" and paste in pc folder its works fine 
But i am getting error on this lne 
context.Response.WriteFile(savepath); 
 
 
[System.Web.Services.WebMethod(EnableSession = true)]
public void ProcessRequest(HttpContext context)
{
try
{
string savepath = "";
string tempPath = "";
tempPath = System.Configuration.ConfigurationManager.AppSettings["ManualExcel"];
savepath = context.Server.MapPath(tempPath);
context.Response.ContentType = "text/plain";
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + "ManualEntry");
context.Response.WriteFile(savepath);
}
catch (Exception ex)
{
throw ex;
}
}
 
Please do need full to me 

Answers (1)