I have a file named "Classes.jsa" in my application. I need to delete this file through C# code. Manually i can delete this file. But not able to delete it through coding. I tried to delete in Admin mode. But showing the error like
Access to the path denied "F:\MyApp\Classes.jsa"
MyCode:
sting fileName=@"F:\MyApp\Classes.jsa";
if(file.exists(fileName))
{
File.Delete(fileName);
}
Anyone can resolve this issue?
Thanks and Regards, Kathiresan S.
I got the answer for this.
The below code working for me:
Code:
sting fileName=@"F:\MyApp\Classes.jsa";
FileInfo file=new FileInfo(fileName);
if(file.exists(fileName))
{
file.IsReadOnly=false;
File.Delete(fileName);
}