Hi Friends,
Why i am getting the below error when i try to delete the image from folder through .net application
System.UnauthorizedAccessException: Access to the path 'Z:\WebApps\DotnetConversion\ITSNET\its_pic1\643825_2.jpg' is denied.
i tried with giving full access to folded.
i tried with giving full access to ASPNET under security tab in properties of the folder
i tried with giving full access to Network Service under security tab in properties of the folder
please help me on this.
Loading
Sanjeeb LenkaPosted Oct 24, 2013, 3:43 AM
use
Server.MapPath();.
example:
string path = Server.MapPath("its_pic1//643825_2.jpg");// check the path in project
FileInfo file = new FileInfo(path);
if (file.Exists)//check file exsit or not
{
file.Delete();
}
Rajesh SPosted Oct 24, 2013, 3:06 AM
FileInfo File_obj = null;
String strpathexists = String.Empty;
strpathexists="Z:\WebApps\DotnetConversion\ITSNET\its_pic1\643825_2.jpg";
File_obj = null;
Sunny SharmaPosted Oct 24, 2013, 2:22 AM
please share your code.