file system object doesn't work in virtual path?

M

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.
 
B

Bob Barrows [MVP]

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
 
M

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.
 
B

Bob Barrows [MVP]

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.
 
M

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.
 
B

Bob Barrows [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top