I am using the below code to save an pdf file in the particular folder. if the folder is not there it will auto create an folder. It is working fine in local. But when i publish the website to IIS. it doesnt work.
string folderPath = "D:\\Labels\\";
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
string file = @"D:\Labels\" + DateTime.Today.ToString("dd-MM-yyhh-mm-ss") + ".pdf" + "";
var fileStream = File.Create(file);
// change file name for PNG images
responseStream.CopyTo(fileStream);
responseStream.Close();
fileStream.Close();
ShowMessage("Downloaded Sucessfully", MessageType.Success);