Unable to getfolder from Virtual Directory
am 02.05.2007 18:15:51 von jbonifacejr
I am unable to use the GetFolder method of the FileSystem object when
trying to get the folders from within a Virtual Directory. Here is my
setup...
I have a Development Box (DB) and a WebServer (WS) and a separate file
server (FS). On FS, I have a share with permission for Everyone set to
Read. On my DevBox I have a website in IIS named CD and inside the
website folder I have a Virtual Directory (Moozik) with the location
set to \\FS\ShareName
When I run the following code, I am shown the error message "Exception
from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)"
oFSO = Server.CreateObject("Scripting.FileSystemObject")
sPath = Server.MapPath("Moozik\")
fRoot = oFSO.GetFolder(sPath)
This is the first time I have ever tried to use virtual directories. I
do not know what kinds of permissions I need to set in IIS on the
Virtual Directory. One thing I did try was to go in and change the
IUSR_Servername anonymous account to ASPNET. I also checked the
Integrated Windows Authentication checkbox. But, even when I did not
have the Integrated Authentication box checked, I got the same error.
One strange thing is that if I open a browser and navigate to "http://
localhost/cdcosmos/Moozik/Gary Hoey/Animal Instinct/Texas Son.wma
I am able to get the song to play in Media Player. So, it is obvious
to me that IIS knows that the folders are there and is able to
navigate them, but I don't know why I can't get the code to work.
Any ideas?
Re: Unable to getfolder from Virtual Directory
am 03.05.2007 10:35:52 von David Wang
If you can navigate to "http://localhost/cdcosmos/Moozik/Gary Hoey/
Animal Instinct/Texas Son.wma", which goes through your UNC Virtual
Directory setup, then everything is already fine. The problem is most
likely within your code, not IIS configuration, and IIS has nothing to
do with your problems.
All of your mentioned changes are actually unnecessary:
- no special permissions needed for UNC Virtual Directory by default
- no need to change from IUSR to ASPNET because they are both local
users with no existence on your FileServer so it doesn't make a
difference
- No need to check Integrated Windows Authentication because that
fails, by design -- search for "Double Hop" and understand
"Delegation" for the answer
I think the problem is in your code:
- What value does "sPath" contain?
- "Moozik\" is not a valid URL name segment - URLs use "/" as segment
separator, and URLs need to be rooted.
- oFSO.GetFolder(sPath) returns an object, which you must assign with
SET
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
On May 2, 9:15 am, jbonifacejr wrote:
> I am unable to use the GetFolder method of the FileSystem object when
> trying to get the folders from within a Virtual Directory. Here is my
> setup...
>
> I have a Development Box (DB) and a WebServer (WS) and a separate file
> server (FS). On FS, I have a share with permission for Everyone set to
> Read. On my DevBox I have a website in IIS named CD and inside the
> website folder I have a Virtual Directory (Moozik) with the location
> set to \\FS\ShareName
>
> When I run the following code, I am shown the error message "Exception
> from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)"
>
> oFSO = Server.CreateObject("Scripting.FileSystemObject")
> sPath = Server.MapPath("Moozik\")
> fRoot = oFSO.GetFolder(sPath)
>
> This is the first time I have ever tried to use virtual directories. I
> do not know what kinds of permissions I need to set in IIS on the
> Virtual Directory. One thing I did try was to go in and change the
> IUSR_Servername anonymous account to ASPNET. I also checked the
> Integrated Windows Authentication checkbox. But, even when I did not
> have the Integrated Authentication box checked, I got the same error.
>
> One strange thing is that if I open a browser and navigate to "http://
> localhost/cdcosmos/Moozik/Gary Hoey/Animal Instinct/Texas Son.wma
>
> I am able to get the song to play in Media Player. So, it is obvious
> to me that IIS knows that the folders are there and is able to
> navigate them, but I don't know why I can't get the code to work.
>
> Any ideas?