none
Where can i get a fully functional smb / cifs class library for .net c#? RRS feed

  • Question

  • I want to create a .net application that connects to network share and any remote machine ,and the user has to enter the UNC path,Domain/username and password.I want to browse all files in that drive and download files from it .I would appreciate any help that can lead me to any smb library for .net as i'm stuck at the moment .

    19karabo91


    • Edited by 19karabo91 Monday, November 11, 2013 9:16 AM
    Monday, November 11, 2013 9:15 AM

Answers

All replies

  • Hi Karabo,

    We have two ways to access the UNC path, you could choose whatever you want.

    The first one is to use a Win32 API called WNetUseConnection. Use this function to connect to UNC path with authentication. Once you have used WNetUseConnection you will be able to access the file via a UNC path as if you were on the same domain. The best way is probably through the administrative build in shares. See some sample c# code in the below page. http://lookfwd.doitforme.gr/blog/media/PinvokeWindowsNetworking.cs.

    The second one is to use another API to map network drive. See this page for more information and sample code. http://www.codeproject.com/Articles/6847/Map-Network-Drive-API.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 12, 2013 2:33 AM
    Moderator
  • Thank you so much for your response and help ,so will i be able to wrap it and change it to work on a winRT framework ?

    19karabo91

    Tuesday, November 12, 2013 6:53 AM
  • Hi Karabo,

    I’m not familiar with WinRT system, I think you should try it yourself if possible. And if you have any questions about WinRT, I commend you post a new thread on this forum. http://social.msdn.microsoft.com/Forums/en-US/home?forum=winappswithcsharp.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 13, 2013 8:28 AM
    Moderator
  • The big problem with this approach is that you're limited to one set of credentials per server so it's impossible to implement a crawler that would crawl different directories on a single server using different credentials (at least not concurrently).

    While the obvious preferred choice is creds-per-server (or even -per-domain) that's sometimes just not possible, especially when working with government systems.

    I've yet to find _any_ way to do with .Net/Windows what I can do on a Linux box with JCifs and a host of other tools... Connect concurrently as multiple different users to a single server. Depressingly, it's easier to do on Windows in Python than .Net as someone's provided a library.
    • Edited by Basiclife Monday, August 18, 2014 7:54 PM
    Monday, August 18, 2014 7:52 PM