Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > IIS6 + FSO.FileExists() + Not working

Reply
Thread Tools

IIS6 + FSO.FileExists() + Not working

 
 
Eric
Guest
Posts: n/a
 
      04-23-2004
Hi Friends
Below is the code tht i m testing..I m trying to run on
windows 2003 server, iis 6.0.
I have given full rights IUSR_ to C:/test folder but also
checked files many times
but It always says fild not found..
cant understand whats going on? I tried with fowardslash
and backslas both but neither is working...There is no
firewall on server.

Filename = "C:/test/sample.txt"
Dim FSO
set FSO = server.createObject
("Scripting.FileSystemObject")
If FSO.FileExists(Filename) Then
Response.write "File found"
Else
Response.Write "File not found"
End If
Set FSO = nothing

Any help would be appreciated...
Thanx
Eric

 
Reply With Quote
 
 
 
 
Roland Hall
Guest
Posts: n/a
 
      04-23-2004
"Eric" wrote in message news:31e601c428ea$21f74cd0$(E-Mail Removed)...
: Hi Friends
: Below is the code tht i m testing..I m trying to run on
: windows 2003 server, iis 6.0.
: I have given full rights IUSR_ to C:/test folder but also
: checked files many times
: but It always says fild not found..
: cant understand whats going on? I tried with fowardslash
: and backslas both but neither is working...There is no
: firewall on server.
:
: Filename = "C:/test/sample.txt"
: Dim FSO
: set FSO = server.createObject
: ("Scripting.FileSystemObject")
: If FSO.FileExists(Filename) Then
: Response.write "File found"
: Else
: Response.Write "File not found"
: End If
: Set FSO = nothing

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
Const strPath = "c:\test\"
Const filename = "sample.txt"

function exists(filespec)
Dim fso, msg
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(strPath & filename)) Then
msg = filespec & " found."
Else
msg = filespec & " not found."
End If
exists = msg
end function
Response.Write(exists(strPath & filename))
%>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
 
 
 
roger
Guest
Posts: n/a
 
      04-23-2004
"Eric" wrote
> Filename = "C:/test/sample.txt"
> Dim FSO
> set FSO = server.createObject ("Scripting.FileSystemObject")
> If FSO.FileExists(Filename) Then
> Response.write "File found"
> Else
> Response.Write "File not found"
> End If
> Set FSO = nothing


The code searches for a file on the *server*.

Are you searching for a file on your client machine?


--
roger


 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      04-23-2004
i m looking for file on the server..
>-----Original Message-----
>"Eric" wrote
>> Filename = "C:/test/sample.txt"
>> Dim FSO
>> set FSO = server.createObject

("Scripting.FileSystemObject")
>> If FSO.FileExists(Filename) Then
>> Response.write "File found"
>> Else
>> Response.Write "File not found"
>> End If
>> Set FSO = nothing

>
>The code searches for a file on the *server*.
>
>Are you searching for a file on your client machine?
>
>
>--
>roger
>
>
>.
>

 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      04-23-2004
what changes u have done?
whts the reason???
Eric
>-----Original Message-----
>"Eric" wrote in message news:31e601c428ea$21f74cd0

$(E-Mail Removed)...
>: Hi Friends
>: Below is the code tht i m testing..I m trying to run on
>: windows 2003 server, iis 6.0.
>: I have given full rights IUSR_ to C:/test folder but

also
>: checked files many times
>: but It always says fild not found..
>: cant understand whats going on? I tried with

fowardslash
>: and backslas both but neither is working...There is no
>: firewall on server.
>:
>: Filename = "C:/test/sample.txt"
>: Dim FSO
>: set FSO = server.createObject
>: ("Scripting.FileSystemObject")
>: If FSO.FileExists(Filename) Then
>: Response.write "File found"
>: Else
>: Response.Write "File not found"
>: End If
>: Set FSO = nothing
>
><%@ Language=VBScript %>
><%
>Option Explicit
>Response.Buffer = True
>Const strPath = "c:\test\"
>Const filename = "sample.txt"
>
>function exists(filespec)
>Dim fso, msg
>Set fso = CreateObject("Scripting.FileSystemObject")
>If (fso.FileExists(strPath & filename)) Then
> msg = filespec & " found."
>Else
> msg = filespec & " not found."
>End If
>exists = msg
>end function
>Response.Write(exists(strPath & filename))
>%>
>
>HTH...
>
>--
>Roland Hall
>/* This information is distributed in the hope that it

will be useful, but
>without any warranty; without even the implied warranty

of merchantability
>or fitness for a particular purpose. */
>Technet Script Center -

http://www.microsoft.com/technet/scriptcenter/
>WSH 5.6 Documentation -

http://msdn.microsoft.com/downloads/list/webdev.asp
>MSDN Library -

http://msdn.microsoft.com/library/default.asp
>
>
>.
>

 
Reply With Quote
 
roger
Guest
Posts: n/a
 
      04-23-2004
"Eric" wrote
> i m looking for file on the server..


In that case I think it must be an IIS 6
security thing, because your code
works fine here.


--
roger


 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      04-23-2004
"Eric" wrote in message news:347801c4292b$ee89b030$(E-Mail Removed)...
: what changes u have done?
: whts the reason???
: Eric

Eric...

I never use c:/ anything since it doesn't make sense to me. / is a virtual
path or parameter and \ is a physical path. You're referencing a physical
path. While / may be supported, this is Windows, not *nix. So, I was not
sure if that was correct and I gave you a sample that does work. If it
still does not work, then you need to check your security rights at the file
system level, anonymous access is enabled and the anonymous user that has
those rights is the one you're using. Also, you do not need full rights.
Modify is all you need. When assigning security rights at the file system
level you should understand the difference and only apply what is needed and
not all inclusive.

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
mrbester
Guest
Posts: n/a
 
      03-03-2005
roger wrote:
> "Eric" wrote
> > i m looking for file on the server..

>
> In that case I think it must be an IIS 6
> security thing, because your code
> works fine here.
>


I had this problem as well, after migrating a website from IIS4 (don't
ask) to IIS6.
Turns out that using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml) gave me the
answer: ACCESS DENIED
After that it was a case of allowing w3wp.exe (in its security context)
permission to get to the file. It's probably NETWORK SERVICE that needs
adding at the file/folder level.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Member-Login not working on IIS6, when in Virtual Directory Uwe ASP .Net 0 05-19-2008 10:32 AM
Startdate - Enddate dropdown not working ASP, IIS6 sd_eds ASP General 2 10-03-2007 04:28 PM
Response.IsClientConnected not working in IIS6 (W2003 Standard Edition SP1)? kibokochui ASP General 5 01-18-2006 09:42 PM
IIS5 > IIS6 Aspx pages with MSAccess dbs no longer working Mark B ASP .Net 8 07-28-2005 10:08 PM
Could Not Access CDO.Message object in IIS6.0 Desmond ASP .Net 2 07-11-2003 06:08 PM



Advertisments