HighTechTalks DotNet Forums  

Calling a DeleteDirectory Method from a Web Service

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Calling a DeleteDirectory Method from a Web Service in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Eric Levin
 
Posts: n/a

Default Calling a DeleteDirectory Method from a Web Service - 08-29-2003 , 12:57 AM






I am trying to call a DirectoryInfo.Delete function from a Web Service but
am getting an Access Denied Error:
System.UnauthorizedAccessException: Access to Path "..." is Denied.

I have tried using Impersonation and setting the FileIOPermissionAttributes,
but am still getting the same error:

Thanks,

[WebMethod]
//[FileIOPermissionAttribute(SecurityAction.PermitOnl y, Write =
"F:\\DirectoryName")]
public bool DeleteDirectory(string Directory)
{
//ImpersonateUser("UserName", "Password", "MACHINE/DOMAIN");
string FTPPath = @"f:\DirectoryName\" + Directory;
FileIOPermission f; // = new FileIOPermission(PermissionState.None);
f = new FileIOPermission(FileIOPermissionAccess.AllAccess, FTPPath);
DirectoryInfo ftp = new DirectoryInfo(FTPPath);
ftp.Delete(true);
ftp.Refresh();
//StopImpersonateUser();
if (ftp.Exists == true)
return false;
else
return true;
}

Eric Levin
Sounddogs.com







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.