Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Create Share Folder

Create Share Folder

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-nettutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexfromto
    wrote on last edited by
    #1

    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.

    M 1 Reply Last reply
    0
    • A alexfromto

      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.

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      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. :)

      A 1 Reply Last reply
      0
      • M Michael Sync

        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. :)

        A Offline
        A Offline
        alexfromto
        wrote on last edited by
        #3

        Thanks. Do you have something like this using VB and not C# Thanks.

        M 1 Reply Last reply
        0
        • A alexfromto

          Thanks. Do you have something like this using VB and not C# Thanks.

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          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. :)

          A 1 Reply Last reply
          0
          • M Michael Sync

            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. :)

            A Offline
            A Offline
            alexfromto
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups