T
terrorix
I want to save uploaded file to disk. I have this construction:
HttpPostedFile myFile = ((HttpRequest)Request).Files["myFile"];
if (myFile != null)
{
string fn = "c:\\Inetpub\\wwwroot\\MyWeb\\upload\\File_1";
try
{
myFile.SaveAs(fn);
lblMsg.Text = "File was uploaded and saved successfully!";
}
catch (Exception exp)
{
lblMsg.Text = "Saving uploaded file error! ... " + exp.Message;
}
}
And i allways get exception :
Access to the path xxx is denied when saving HttpPostedFile file.
What i'm going wrong? In IIS configuration of MyWeb on folder "upload" i set ut write permission.
HttpPostedFile myFile = ((HttpRequest)Request).Files["myFile"];
if (myFile != null)
{
string fn = "c:\\Inetpub\\wwwroot\\MyWeb\\upload\\File_1";
try
{
myFile.SaveAs(fn);
lblMsg.Text = "File was uploaded and saved successfully!";
}
catch (Exception exp)
{
lblMsg.Text = "Saving uploaded file error! ... " + exp.Message;
}
}
And i allways get exception :
Access to the path xxx is denied when saving HttpPostedFile file.
What i'm going wrong? In IIS configuration of MyWeb on folder "upload" i set ut write permission.