|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
||||
|
||||
|
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! |
|
#6
|
|||
|
|||
|
You're welcome!
|
|
#7
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > FileExists not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|