I upload company logo in application,It's working but when i publish and check it getting error
here is post method of image
[HttpPost]
public string Logo()
{
WebImage photo = null;
var imagePath = "";
photo = WebImage.GetImageFromRequest();
string tempname = "";
if (photo.FileName.Contains("\\"))
{
tempname = photo.FileName.Substring((photo.FileName.LastIndexOf("\\") + 1), (photo.FileName.Length - (photo.FileName.LastIndexOf("\\") + 1)));
}
else
{
tempname = photo.FileName;
}
string fname = tempname;
imagePath = Server.MapPath("~/Content/Temp/") + fname;
photo.Resize(photo.Width, 300, true);
photo.Save(imagePath);
return "<img src='/Content/Temp/" + fname + "' class='preview' id='targetimage' >";
}
i am getting this error System.UnauthorizedAccessException: Access to the path 'C:\inetpub\wwwroot\SCL Mngmnt Test Link_08_Feb\Content\Temp\Desert.jpg' is denied