Home All Groups Group Topic Archive Search About

file system object doesn't work in virtual path?



Author
28 Mar 2006 9:42 PM
mbosco51
Hi.  I have a virtual path setup in order to give my web server access
to a file on my app server.  I am using the file system object to check
for the existance of the file and if it exists, it has to validate the
file date.

The problem is I can't seem to find the file.  I can successfully check
for the existance of a file on the web server, but once I enter the
virtual path it can't find anything.  All three of these calls return
false...

fso.FileExists("http://server/localfolder/virtualfolder/test.txt")
fso.FileExists("/localfolder/virtualfolder/test.txt")
fso.FileExists(Server.MapPath("/localfolder/virtualfolder/test.txt"))

However these two calls work, so I assume I am referencing the file
correctly...

Response.Redirect "http://server/localfolder/virtualfolder/test.txt"
Response.Redirect "/localfolder/virtualfolder/test.txt"

Am I doing something wrong here?  The virtual path is setup with an id
that has full access to the folder.

Thanks.

Author
28 Mar 2006 10:45 PM
Bob Barrows [MVP]
mbosc***@hotmail.com wrote:
>
> fso.FileExists("http://server/localfolder/virtualfolder/test.txt")
> fso.FileExists("/localfolder/virtualfolder/test.txt")
> fso.FileExists(Server.MapPath("/localfolder/virtualfolder/test.txt"))

This is the only one that should work. FileSystemObjects need a file-system
paths, not urls. Server.MapPath returns a file-system path.

>
> However these two calls work, so I assume I am referencing the file
> correctly...
>
> Response.Redirect "http://server/localfolder/virtualfolder/test.txt"
> Response.Redirect "/localfolder/virtualfolder/test.txt"

Why didn't you test this?
Response.Write Server.MapPath("/localfolder/virtualfolder/test.txt")

Does that display the correct file-system path?
>
> Am I doing something wrong here?  The virtual path is setup with an id
> that has full access to the folder.
>
If the correct file-system path is displayed, then there is a permissions
problem.
If your website has Anonymous access enabled, then the IUSR and IWAM
accounts require access to the folder. It is those accounts that asp code
run under when Anounymous is used (unless another account was configured to
be used ).
Otherwise, the users of your site need access.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Author
29 Mar 2006 3:50 PM
mbosco51
Thanks Bob.  Yes, Response.Write
Server.MapPath("/localfolder/virtualfolder/test.txt")  returns the
correct physical path.  I will look into getting the IUSR and IWAM
accounts access to the app server.  I just need to create accounts
using the same id/password on the app server, correct?

I guess I was thrown off track because when I created the virtual
folder it prompted me to enter a id/password.  I entered one that does
have rights to the app server, therefore I thought this would take care
of all the permissions.  If this id is not used when accessing the app
server, then what is it for?

Thanks.
Author
29 Mar 2006 5:02 PM
Bob Barrows [MVP]
mbosc***@hotmail.com wrote:
> Thanks Bob.  Yes, Response.Write
> Server.MapPath("/localfolder/virtualfolder/test.txt")  returns the
> correct physical path.  I will look into getting the IUSR and IWAM
> accounts access to the app server.  I just need to create accounts
> using the same id/password on the app server, correct?
>

No, they should already be there if IIS is installed.

> I guess I was thrown off track because when I created the virtual
> folder it prompted me to enter a id/password.

What tool did you use to create this virtual directory?

> I entered one that does
> have rights to the app server, therefore I thought this would take
> care of all the permissions.  If this id is not used when accessing
> the app server, then what is it for?
>
I'm not sure - I was never prompted for a id/password when creating a
virtual folder.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Author
29 Mar 2006 6:05 PM
mbosco51
IIS is installed on the web server, but not the app server.  I thought
what you were saying is I need to create the same accounts on the app
server, or did I misinterpret?

I created the virtual directory within IIS.  It first asked me for an
alias, then a path.  When you put in the path of a different server, it
presents a screen that says...

Security Credentials
Enter the user name and password that should be used to gain access to
the network directory.

By default the following is checked: Always use the authenticated
user's credentials when validating access to the network directory.

I unchecked this and entered an id/password that I know has access to
the folder on the app server (the one the virtual directory is pointing
to).

Thanks.


Bob Barrows [MVP] wrote:
Show quote
> mbosc***@hotmail.com wrote:
> > Thanks Bob.  Yes, Response.Write
> > Server.MapPath("/localfolder/virtualfolder/test.txt")  returns the
> > correct physical path.  I will look into getting the IUSR and IWAM
> > accounts access to the app server.  I just need to create accounts
> > using the same id/password on the app server, correct?
> >
>
> No, they should already be there if IIS is installed.
>
> > I guess I was thrown off track because when I created the virtual
> > folder it prompted me to enter a id/password.
>
> What tool did you use to create this virtual directory?
>
> > I entered one that does
> > have rights to the app server, therefore I thought this would take
> > care of all the permissions.  If this id is not used when accessing
> > the app server, then what is it for?
> >
> I'm not sure - I was never prompted for a id/password when creating a
> virtual folder.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
Author
29 Mar 2006 7:16 PM
Bob Barrows [MVP]
mbosc***@hotmail.com wrote:
Show quote
> IIS is installed on the web server, but not the app server.  I thought
> what you were saying is I need to create the same accounts on the app
> server, or did I misinterpret?
>
> I created the virtual directory within IIS.  It first asked me for an
> alias, then a path.  When you put in the path of a different server,
> it presents a screen that says...
>
> Security Credentials
> Enter the user name and password that should be used to gain access to
> the network directory.
>
> By default the following is checked: Always use the authenticated
> user's credentials when validating access to the network directory.
>
> I unchecked this and entered an id/password that I know has access to
> the folder on the app server (the one the virtual directory is
> pointing to).
>
> Thanks.
>
There are still filesytem permissions to worry about. see this article:
http://www.aspfaq.com/show.asp?id=2168
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

AddThis Social Bookmark Button