ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 18th, 2003, 05:32 PM
aaron.martone's Avatar
aaron.martone aaron.martone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Central Florida
Posts: 76 aaron.martone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to aaron.martone
Exclamation FileExists not working

I just came into some work where someone's been before. And I have to clean up their mess. Anyways, the deal is like this. We have these images, that are located on our network.

r:\folder1\folder2\images

The web server is being run locally at:

c:\inetpub\wwwroot\intranet

On a page.asp, I have the following code:

dim fso
Set fso=Server.CreateObject("Scripting.FileSystemObject")

strImgPath = "r:\folder1\folder2\images\" & rsImage("imgPath")
blnImgExists = fso.FileExists(strImgPath)

Set fso = nothing

============

It comes back with strImgPath = "r:\folder1\folder2\images\pic1.jpg" and blnImgExists = false

Oddly enough I will cut and paste the value of strImgPath into a window and BOOM, image is there. For some reason, FileExists is not returning a valid response.

My thoughts were that FileExists cannot work across a network, whether it be a security feature or not, but I have not been able to find whether this is true. I also tried working with WshNetwork and MapNetworkDrive but to no avail.

Can someone shed some light on the situation?
__________________
aaron martone
professional web developer

Reply With Quote
  #2  
Old November 18th, 2003, 07:31 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,234 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 7 h 12 m 7 sec
Reputation Power: 909
Likely this is a permissions issue. IIS normally operates under a local user account IUSR_computername, and that local account probably has zero permissions to the mapped network drive.

Reply With Quote
  #3  
Old November 18th, 2003, 08:41 PM
aaron.martone's Avatar
aaron.martone aaron.martone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Central Florida
Posts: 76 aaron.martone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to aaron.martone
So even though I'm logged in as administrator, I need to give administrative rights to my IUSR_computername user? That sounds a bit risky. Even though this is setup for an intranet, and everyone is "trustworthy", I don't want to develop any kind of bad "coding" habit.

Is there a way to give the IUSR account the permission to access the file? Is this something I would need to setup in the Policy Manager? Or can I just rightclick on the file/folder in question and apply some kind of privlledge to that resource?

I've already been told that I cannot move the images from their current location. I tried to create a VIRTUAL DIRECTORY in the wwwroot\intranet\images folder but for the ODDEST reason, the virtual folder KEEPS disappearing after I set it up.

Reply With Quote
  #4  
Old November 18th, 2003, 11:21 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,234 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 7 h 12 m 7 sec
Reputation Power: 909
First, it's possible your IIS is configured differently, so check before you make a lot of permission changes. IIS will use the IUSR_computername user account when serving anonymous web browsers. If you application forces users to authenticate to the web server, then IIS will impersonate that logged in user.

The IUSR account is normally a local user account, only on the web server computer itself. If you're mapping to a different computer the easiest way is to create a bogus IUSR_computername account on the target machine with the same password, and then grant that IUSR_ account permission to the files you want to share. You don't need (or want) to grant administrator privileges to the IUSR account.

I have never tried a virtual directory to a mapped drive, but it could be related to the same kind of permissions issue.

This article may apply

http://support.microsoft.com/defaul...kb;EN-US;189408

Reply With Quote
  #5  
Old November 21st, 2003, 03:39 PM
aaron.martone's Avatar
aaron.martone aaron.martone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Central Florida
Posts: 76 aaron.martone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to aaron.martone
Doug,

I really appreciate the help. Oddly enough it seems that this situation was great enough to warrant us attempting to move all the data to one database. This SHOULD resolve the issue, but I will keep in note the idea the the IUSR account probably does not have the rights for going across the network.

My thanks!

Reply With Quote
  #6  
Old November 21st, 2003, 08:03 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,234 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 7 h 12 m 7 sec
Reputation Power: 909
You're welcome!

Reply With Quote
  #7  
Old December 14th, 2003, 03:07 AM
LU5|2 LU5|2 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 LU5|2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to LU5|2
try this

Maybe you have already tried this but if i do:

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
strFile = Server.MapPath(request.querystring("arg"))
if fs.FileExists(strFile)=true then
response.write(strFile & " exists!")
else
response.write(strFile & " does not exist!")
end if
set fs=nothing
%>

just put any filename in the querystring as
.asp?arg=file_to_check

it works fine everytime

hope that helps, at least it's still dynamic although i'm not sure why it works.
maybe the filesystemobject just has issues with mapping a relative path or something.
But then again i'm a n00b.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > FileExists not working


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT