follow below code here i have saved my csv file C:\ drive,
strcontent is the content which you want to save in csv file
try
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=Report.csv");
Response.ContentType = "application/octet-stream";
Response.Write(strContent);
Response.End();
}
catch (System.Threading.ThreadAbortException ex)
{
StreamWriter sw = new StreamWriter(@"c:/Report.csv");
sw.Write(strContent);
sw.Close();
System.IO.FileInfo fileInfo = new FileInfo(@"c:/");
fileInfo.Delete();
}