Create Share Folder
-
Hi guys. I have ASP.NET application and I create folder the application to store files. Later on these files are access by database so I can parse them. In order for database (db is on another machine) to see these files I must us UNC file path. Of course the folder has to be shared so db can access it. I can easily create folder but have no idea how to make it share. Can anyone tell me how to do that? Is there any easy way I can programatically create share folder right away? Any code samples will be appreciated. Thanks a lot. Alex.
-
Hi guys. I have ASP.NET application and I create folder the application to store files. Later on these files are access by database so I can parse them. In order for database (db is on another machine) to see these files I must us UNC file path. Of course the folder has to be shared so db can access it. I can easily create folder but have no idea how to make it share. Can anyone tell me how to do that? Is there any easy way I can programatically create share folder right away? Any code samples will be appreciated. Thanks a lot. Alex.
Creating a shared folder in C#.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
Creating a shared folder in C#.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Thanks. Do you have something like this using VB and not C# Thanks.
-
Thanks. Do you have something like this using VB and not C# Thanks.
why dont you use C# to VB.NET Converter?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
-
why dont you use C# to VB.NET Converter?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)
Thanks man. That's exactly what I did :). Here we go, just in case you'll need it. Import System.Management library into your project first then,
Try ' Create a ManagementClass object Dim managementClass As System.Management.ManagementClass = New System.Management.ManagementClass("Win32_Share") ' Create ManagementBaseObjects for in and out parameters Dim inParams As System.Management.ManagementBaseObject = managementClass.GetMethodParameters("Create") Dim outParams As System.Management.ManagementBaseObject ' Set the input parameters inParams("Description") = "My Shared Files" inParams("Name") = partner_name inParams("Path") = Session("Path").ToString() ' This is a path to existing directory inParams("Type") = 0 ' Disk Drive ' Invoke the method on the ManagementClass object outParams = managementClass.InvokeMethod("Create", inParams, Nothing) ' Check to see if the method invocation was successful If (CType(outParams.Properties("ReturnValue").Value, Integer) <> 0) Then Throw New Exception("Unable to share directory.") End If Catch ex As Exception 'Return e.Message End Try