473,664 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file system object doesn't work in virtual path?

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.Redire ct "http://server/localfolder/virtualfolder/test.txt"
Response.Redire ct "/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.

Mar 28 '06 #1
5 6942
mb******@hotmai l.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. FileSystemObjec ts 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.Redire ct "http://server/localfolder/virtualfolder/test.txt"
Response.Redire ct "/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.
Mar 28 '06 #2
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.

Mar 29 '06 #3
mb******@hotmai l.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.
Mar 29 '06 #4
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:
mb******@hotmai l.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.


Mar 29 '06 #5
mb******@hotmai l.com wrote:
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.
Mar 29 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4172
by: Bennie | last post by:
Hi, I have a problem with ZipFile. It works okay untily I come across a file that is greater then 1Gb. Then it exit with the error: OverflowError: long int too large to convert to int How can I fix this? souce:
17
2317
by: Joe Laughlin | last post by:
I've not used C much before, so I don't know how robust or good this code is. I'd appreciate any feedback or criticisms anyone has! Thanks, Joe #include <stdio.h> #include <string.h>
13
4297
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
13
1875
by: DC Gringo | last post by:
How do I test for existence of a file in the file system: If FileExists(myVariable & ".pdf") = True pnlMyPanel.Visible = True End If -- _____ DC G
26
2604
by: Niggy | last post by:
I am trying to load a file from a dropdownlist, however I get a error saying a virtual path is required. An example selected value would be "../4900/myfile.doc". Any ideas - my code is. Dim sumfin As String = DropDownList1.SelectedValue.ToString Dim pos As Integer = sumfin.Length Dim bString As String = sumfin.Substring(3, pos - 3) Dim cString As String = "http://localhost/" & bString Server.Transfer(cString)
10
2429
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
5
4628
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } Despite the path exist along with the file name, the code never gets executed.
24
5056
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the same code, except a different name for the file. The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\Accident.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
0
2012
by: Steve | last post by:
Hello- Your assistance with this issue is greatly appreciated. Environment: - Load-balanced IIS 6.0 servers (Win2003) - web servers point (via UNC path) to a Microsoft File Cluster on different machines. - domain ASPNET account that handles the function/permissions of the (traditionally) local machine ASP.NET account.
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.