network-share

How can I enumerate network shares and web folders in C#?

这一生的挚爱 提交于 2019-12-01 19:36:42
.Net provides us with a FolderBrowserDialog control to browse for folders. This is however a modal dialog box. I need to create a user control that I can drop onto my form. So, I have been looking at creating my own, where I need to get all local drives, mapped network drives, UNC shares and web folders (WebDAV/SharePoint). I am using Windows 7 and .Net 4.0. Local and Mapped Network Drives I can get the local drives from DriveInfo.GetDrives(). However, these are only showing me the drives that are available/online. In Windows Explorer, you also see mapped network drives that are disconnected

Python 2: Get network share path from drive letter

烈酒焚心 提交于 2019-12-01 16:16:34
If I use the following to get the list of all connected drives: available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)] How do I get the UNC path of the connected drives? os.path just returns z:\ instead of \share\that\was\mapped\to\z Use win32wnet from pywin32 to convert your drive letters. For example: import win32wnet import sys print(win32wnet.WNetGetUniversalName(sys.argv[1], 1)) This gives me something like this when I run it: C:\test>python get_unc.py i:\some\path \\machine\test_share\some\path Using ctypes and the code shown in the first answer in

401.1 Error when accessing virtual directory pointing to network share

前提是你 提交于 2019-12-01 08:28:41
IIS5 is running on SERVER1. One of the virtual directories in IIS, myfiles, is pointing to "A shared location on another computer", //SERVER2/myfilesshare When I try to access the page: http://SERVER1/myfiles ... I get the error: You are not authorized to view this page HTTP 401.1 - Unauthorized: Logon Failed Internet Information Services I have triple-checked the "Connect As..." settings in IIS. The credentials I'm using to access the share are correct-- they work when connect to the share in Windows Explorer, but not through the IIS virtual directory. I've tried granting full permission to

401.1 Error when accessing virtual directory pointing to network share

时光怂恿深爱的人放手 提交于 2019-12-01 06:18:49
问题 IIS5 is running on SERVER1. One of the virtual directories in IIS, myfiles, is pointing to "A shared location on another computer", //SERVER2/myfilesshare When I try to access the page: http://SERVER1/myfiles ... I get the error: You are not authorized to view this page HTTP 401.1 - Unauthorized: Logon Failed Internet Information Services I have triple-checked the "Connect As..." settings in IIS. The credentials I'm using to access the share are correct-- they work when connect to the share

Unable to connect to network share

佐手、 提交于 2019-11-29 12:57:44
I'm trying to connect to a network share (by it's UNC) from the browser, but am unable to. If I run my script from the command line, everything is fine and I can access the share. I'm also able to navigate to it through Windows' file explorer, so I don't think there's anything wrong with my code, or the permissions for my Windows account. My script looks like this: $dir = '\\\\some\path'; if (is_dir($dir)) { echo 'dir exists'; } else { echo 'dir does not exist'; } I also tried using DirectoryIterator($dir) , but that throws this exception error: PHP Warning: opendir(...): Access is denied.

HTML links to local network shares [duplicate]

巧了我就是萌 提交于 2019-11-29 05:45:50
This question already has an answer here: Linking a UNC / Network drive on an html page 3 answers Why do these links not work? If I click on them in FF or Chrome, nothing happens - it doesn't even try to open them! <a href="file://someshare/dir/subdir/file.txt">Linky</a> <a href="file:////someshare/dir/subdir/file.txt"> Linky</a> <a href="file://\\someshare\dir\subdir\file.txt">Linky</a> Any ideas? Peter In general, this is disabled because it is a security risk. See also this question: Cross-browser link to file on local system , and the link provided by sleske to here . This is an oldie, but

Executable started by a windows service using the local system account cannot access network shares

你说的曾经没有我的故事 提交于 2019-11-29 00:09:38
问题 I have an executable that is started by a windows service, this program will be run on a customers machine and will need to connect to a remote share to perform a particular task. This share is specified by the customer via a UI, so we do not know this in advance meaning it can't be "hard-coded", or the share mapped in advance. Previously we required the customer to log on to their machine and run the executable on log-on , but we have always wanted to allow our program to run within a

Security warning when opening file from network share

两盒软妹~` 提交于 2019-11-28 18:01:02
问题 I've created a setup executable which I have signed. It's located on a network share (which I access using unc - \server\share\setup.exe). When I double click the executable file, I get a Windows warning saying: Title: Open File -> Security Warning Do you want to run this file? Name: setup.exe Publisher: My Company Type: Application From: \\Path\to\setup\folder Then there's a yellow shield with the text "While files from the Internet can be useful, this file type can potentially harm your

C# network connection running from shared drive

扶醉桌前 提交于 2019-11-28 12:56:59
I'm trying to read web resource fron within the C# code. Unfortunately the code is valid only when running from local drive and throws exception when running from network share (and that's what I need). The underlying connection was closed: Unable to connect to the remote server. in System.Net.HttpWebRequest.GetResponse() ......... Caused by: An invalid argument was supplied in System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) in System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress&

Cannot access files on drive mapped network share from a Windows service

旧城冷巷雨未停 提交于 2019-11-28 12:13:44
I have a network shared folder mapped to a drive letter, which is accessible from Windows Explorer, from the command prompt as well as from my WinForms application without problem. It is also accessible from my Windows service using a UNC path. However, when I attempt to access this network location using a mapped drive letter from the Windows service, access fails. The Windows service is configured to use my personal "Log On" account credentials, which is the same in all the above cases. I am an administrator. Many customer sites utilize drive letters for network shares and I cannot always