IIS6 + FSO.FileExists() + Not working

Discussion in 'ASP General' started by Eric, Apr 23, 2004.

  1. Eric

    Eric Guest

    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
    Eric, Apr 23, 2004
    #1
    1. Advertising

  2. Eric

    Roland Hall Guest

    "Eric" wrote in message news:31e601c428ea$21f74cd0$...
    : 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
    Roland Hall, Apr 23, 2004
    #2
    1. Advertising

  3. Eric

    roger Guest

    "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
    roger, Apr 23, 2004
    #3
  4. Eric

    Eric Guest

    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
    >
    >
    >.
    >
    Eric, Apr 23, 2004
    #4
  5. Eric

    Eric Guest

    what changes u have done?
    whts the reason???
    Eric
    >-----Original Message-----
    >"Eric" wrote in message news:31e601c428ea$21f74cd0

    $...
    >: 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
    >
    >
    >.
    >
    Eric, Apr 23, 2004
    #5
  6. Eric

    roger Guest

    "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
    roger, Apr 23, 2004
    #6
  7. Eric

    Roland Hall Guest

    "Eric" wrote in message news:347801c4292b$ee89b030$...
    : 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
    Roland Hall, Apr 23, 2004
    #7
  8. Eric

    mrbester Guest

    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.
    mrbester, Mar 3, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Poppy

    FileExists FSO

    Poppy, Mar 2, 2004, in forum: ASP General
    Replies:
    3
    Views:
    131
    Evertjan.
    Mar 2, 2004
  2. Rudi Ahlers

    objFSO.FileExists not working?????

    Rudi Ahlers, Apr 10, 2004, in forum: ASP General
    Replies:
    15
    Views:
    751
    Lord Merlin
    Apr 13, 2004
  3. Thomas
    Replies:
    36
    Views:
    1,306
    Thomas
    Mar 22, 2005
  4. Guest

    IIS6 & FSO remote server access

    Guest, Apr 8, 2005, in forum: ASP General
    Replies:
    0
    Views:
    175
    Guest
    Apr 8, 2005
  5. Bob
    Replies:
    1
    Views:
    312
    Ray Costanzo [MVP]
    Apr 26, 2005
Loading...

Share This Page