Hi Steven,
Assuming you are using this logic from within a web service, you're going
to have issues due to the "managed" part of managed code implementation.
Under most circumstances (all if you love your server), try and avoid
giving remote callers logic that directly touches the local disk.
Another problem you will have is that the file system isn't IP addressable
like this - you'd have to put local disk manipulation functions within your
server side implementation, and then change the sandbox security so that
the special file system type called a directory can be "opened" and "read"
by the web service code. The code you have here seems on the surface to be
inadequate to do what you are trying to do.
The classes System.IO.Directory and System.IO.DIrectoryInfo seem to be
better suited to the problem space you seem to want to attack.
I hope this helps
Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: WebRequest to see if Directory exists
thread-index: AcToTbDdSVhZFUvIST+h/342wtJUug==
X-WBNR-Posting-Host: 216.162.164.190
From: "=?Utf-8?B?U3RldmVuIEouIFJlZWQ=?="
<St*********@discussions.microsoft.com>
Subject: WebRequest to see if Directory exists
Date: Wed, 22 Dec 2004 09:43:05 -0800
Lines: 30
Message-ID: <B0**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:8268
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
I am trying to find out is a folder exists within a share on a server. I
can
successfully determine if a file exists within the share, but I can't
figure
out how to determine if it's parent folder exists.
This is what I'm trying:
Dim fwrqFolder As FileWebRequest
Dim fwrFolder As FileWebResponse
Dim uriFolder As Uri
Try
Dim strPathName as String = "10.0.0.50/DemoProj/PDQ"
uriFolder = New Uri("file://" & strPathName)
fwrqFolder = CType(WebRequest.Create(uriFolder),
FileWebRequest)
fwrFolder = CType(fwrqFolder.GetResponse(),
FileWebResponse)
Catch err As WebException
MsgBox(("WebException: " + err.Message))
The error says: Access to the path "\10.0.0.50\DemoProj\PDQ" is denined.
However, if I add an existing filename to the path it works.
The share is defined as a Virtual Directory with Read, Write, and Directory
Browsing. Directory Security is set to allow Anonymous access.
Any suggestions?
Thanks...Steve