unc

I can't access unc path from C#. Getting access is denied

妖精的绣舞 提交于 2019-12-08 06:33:55
问题 I'm using Windows Server 2008 and IIS 7.5 I'm trying to access a file this way: \server\C$\temp\testFile.log from C# code running on another server. My username is an admin on both servers. The code is running under that account. The temp folder has been set to full rights for (my user) and ASP.NET. Why can't I access it? I can't do a shared folder; against the rules. I am already running under full account; therefore, I don't need to do impersonation, right? 回答1: Is this a web app? Are you

Server.MapPath not accepting UNC URL

删除回忆录丶 提交于 2019-12-08 03:51:26
问题 I'm having a bit of trouble loading an XML file with ASP. This is the location of the XML file (it's a UNC url): \\ilife104\teamdisk\Shared\Integration\System\dev\Data\prcImportFactSetFeeds\fileList.xml And this is my code: <% 'load the XML file.. Option Explicit Response.Buffer = True Dim xml Set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = False xml.load (Server.MapPath("\\ilife104\teamdisk\Shared\Integration\System\dev\Data\prcImportFactSetFeeds\fileList.xml")) Dim name,

Convert windows path to UNC in Ruby

心不动则不痛 提交于 2019-12-07 09:58:34
I'd like to convert the following PATH into a UNC path in Ruby. C:/Users/bla/bla2/asdf-ut-script.js A UNC path requires that you know the name of the server and share, neither of which are present in your path, unless you're looking for something like: \\localhost\C$\Users\bla\bla2\asdf-ut-script.js If this is what you want: def File.to_unc( path, server="localhost", share=nil ) parts = path.split(File::SEPARATOR) parts.shift while parts.first.empty? if share parts.unshift share else # Assumes the drive will always be a single letter up front parts[0] = "#{parts[0][0,1]}$" end parts.unshift

Delphi - Comparing two pathnames when one is UNC and one is drive letter-specified

荒凉一梦 提交于 2019-12-07 05:42:01
问题 I have a situation where a user can specify two separate pathnames, and I need to check whether one pathname is "inside" the other one. I can do this if both pathnames are UNC, or both are drive-letter-based, but what if they are mixed? Can you "normalise" a path such as "C:\Program Files" to "\\[this computer name]\C\Program Files"? Obviously, I can't go the other way, as a network folder in UNC format may not have a corresponding drive letter mapped to it. 回答1: Have a look at

Using batch file and WinSCP to download files from the FTP server to file server (shared folder)

纵然是瞬间 提交于 2019-12-06 16:27:29
I am using the following code to transfer files from my FTP server to my local machine which works fine. "C:\Program Files (x86)\WinSCP\WinSCP.com" /command ^ "open ftp://rnandipati:J13@Files8.cyberlynk.net/kgptel/" ^ "lcd ""C:\\rnandipati\KGP\File History""" ^ "get *.xls>1D" ^ "rm *.xls<1D" ^ "exit" Now, I access my server using this path \\fs01\\Reporting\KGP\File History When I put this path in place of my local directory path, it shows an error that the system could not find the file specified and error changing directory. Thanks. Martin Prikryl A UNC path cannot be a working directory in

UNC Path Appears To Slow File Enumeration Considerably

六月ゝ 毕业季﹏ 提交于 2019-12-06 14:24:39
问题 I have written a sample application to debug an issue with enumerating files. Enumerating a directory with a local path (eg C:\Data\MAN) enumerates considerably quicker than a shared directory with a UNC path (eg \\MACHINENAME\man). Even though these paths both point to the same directory on the local machine. With 72000 files, this takes approx 10 seconds: DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Data\MAN"); FileInfo[] fileInfoTest = directoryInfo.GetFiles("*.*", SearchOption

Get-ChildItem not working with long UNC path

有些话、适合烂在心里 提交于 2019-12-06 11:39:33
问题 I try to use long UNC paths with Get-ChildItem in Powershell like Get-ChildItem -Path "\\?\c:\blabla" and Powershell says that there are illegal characters in the path. The very same path works with Resolve-Path . How can I use the "\\?\" syntax with gci ? 回答1: Great news! PowerShell v6.0.0-beta.3 and up now supports UNC paths by default ; it automatically prepends the UNC string to paths > 260 characters: https://github.com/PowerShell/PowerShell/releases/tag/v6.0.0-beta.3 https://github.com

UNC path pointing to local directory much slower than local access

早过忘川 提交于 2019-12-05 23:33:12
问题 Some code I'm working with occasionally needs to refer to long UNC paths (e.g. \\?\UNC\MachineName\Path), but we've discovered that no matter where the directory is located, even on the same machine, it's much slower when accessing through the UNC path than the local path. For example, we've written some benchmarking code that writes a string of gibberish to a file, then later read it back, multiple times. I'm testing it with 6 different ways to access the same shared directory on my dev

How can I determine if a string is a local folder string or a network string?

元气小坏坏 提交于 2019-12-05 01:37:20
How can I determine in c# if a string is a local folder string or a network string besides regular expression? For example: I have a string which can be "c:\a" or "\\foldera\folderb" new Uri(mypath).IsUnc I think the full answer to this question is to include usage of the DriveInfo.DriveType property. public static bool IsNetworkPath(string path) { if (!path.StartsWith(@"/") && !path.StartsWith(@"\")) { string rootPath = System.IO.Path.GetPathRoot(path); // get drive's letter System.IO.DriveInfo driveInfo = new System.IO.DriveInfo(rootPath); // get info about the drive return driveInfo

UNC Path Appears To Slow File Enumeration Considerably

心不动则不痛 提交于 2019-12-04 19:45:01
I have written a sample application to debug an issue with enumerating files. Enumerating a directory with a local path (eg C:\Data\MAN) enumerates considerably quicker than a shared directory with a UNC path (eg \\MACHINENAME\man). Even though these paths both point to the same directory on the local machine. With 72000 files, this takes approx 10 seconds: DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Data\MAN"); FileInfo[] fileInfoTest = directoryInfo.GetFiles("*.*", SearchOption.AllDirectories); With 72000 files, this takes approx 2 minutes: (where \\MACHINENAME\man is shared folder