By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

WebRequest to see if Folder exists

P: n/a
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://" & rstrPathName)
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
Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Steven,

Did you try the newsgroup

microsoft.public.dotnet.framework.aspnet.security?

Cor

"Steven J. Reed" <St*********@discussions.microsoft.com>
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://" & rstrPathName)
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

Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.