Thanks, Peter
The cod eI used to create shared folder is:
try
{
Directory.CreateDirectory(fileUploadPath);
ManagementClass managementClass = new
ManagementClass("Win32_Share");
ManagementBaseObject inParams =
managementClass.GetMethodParameters("Create");
ManagementBaseObject outParams;
inParams["Description"] = @"Directory for Image File
Upload";
inParams["Name"] = "temp";
inParams["Path"] = "c:\temp2";
inParams["Type"] = 0x0;
inParams["Access"] = null;
outParams = managementClass.InvokeMethod("Create",
inParams, null);
if((uint)(outParams.Properties["ReturnValue"].Value) != 0)
{
throw new Exception("Unable to shared directory.");
}
}
catch(Exception ex)
{
if (log.IsErrorEnabled)
{
log.Error(string.Format("Can not create shared {0}.
Error: {1}", shardFolderName, ex.Message));
}
}
I used it in a web service. When the web service run from VS 2005, the
shared folder c:\temp created. But, when I moved the web service to
inetpub, the c:\temp2 created but it was not a shared folder.
Thank.
Peter wrote:
Do you want to post a "Short but Complete" snippet of working code so our
cadre of expert folder sharers can help you out?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"jz****@gmail.com" wrote:
Hi, All
I use VS 2005 to create a web service. The web service is used to
create a sheared folder. It works fine we I run it from VS 2005. But,
when I move it to inetpub, it does not work (folder is created but is
not shared).
Does anyone know how to solve this problem?
Thanks.