Hi akhter,
Apply proper permissions to the folders it does not have access.
You need to provide Read/Write permissions to
IIS_USR
NETWORK SERVICE
IIS_USRS
Access to the path denied error also came if file doesn't exist.
Before Response.WriteFile you should perform a check to see if the file exists first.
This will also give you the opportunity of making sure that the path it's attempting to get will work.
if(File.Exist(fileName))
{
Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
Response.ContentType = "application/sql";
Response.WriteFile(fileName);
Response.End();
}