ASP Script Hangs

Discussion in 'ASP General' started by Andi B, Mar 23, 2005.

  1. Andi B

    Andi B Guest

    Hi folks,

    Wondering if anyone can help me - I have recently set up a website on our
    work intranet, which allows staff members in our team to attach a photo of
    themselves to their profile on the page. The photos are uploaded to the
    webserver by an ASP script. I am now trying to get an addition written
    which allows for the deletion of old files that are no longer used by
    anyones profile. I have written the following to list the contents of the
    folder, but whenever I test the script on my home computer (WinXP Pro, SP2,
    IIS 5.1) the ASP hangs - it produces no output, not even an error. Can
    anyone offer any assistance on what I might need to do to get it working
    correctly?

    <%@ Language=VBScript %>

    <%
    Option Explicit
    Dim objFSO
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    Dim objFolder

    Dim strCurrentFolder
    strCurrentFolder = "images/staff"

    Set objFolder = objFSO.GetFolder(strCurrentFolder)

    Dim objFile

    For Each objFile in strCurrentFolder.Files
    Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    Next

    Set objFSO = Nothing
    Set objFolder = Nothing
    %>

    Thanks in advance of any assistance,

    Andi
    Andi B, Mar 23, 2005
    #1
    1. Advertising

  2. Andi B

    Steven Burn Guest

    Change strCurrentFolder to Server.MapPath(strCurrentFolder)

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Andi B" <> wrote in message news:4241bf6b$0$26751$...
    > Hi folks,
    >
    > Wondering if anyone can help me - I have recently set up a website on our
    > work intranet, which allows staff members in our team to attach a photo of
    > themselves to their profile on the page. The photos are uploaded to the
    > webserver by an ASP script. I am now trying to get an addition written
    > which allows for the deletion of old files that are no longer used by
    > anyones profile. I have written the following to list the contents of the
    > folder, but whenever I test the script on my home computer (WinXP Pro, SP2,
    > IIS 5.1) the ASP hangs - it produces no output, not even an error. Can
    > anyone offer any assistance on what I might need to do to get it working
    > correctly?
    >
    > <%@ Language=VBScript %>
    >
    > <%
    > Option Explicit
    > Dim objFSO
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    >
    > Dim objFolder
    >
    > Dim strCurrentFolder
    > strCurrentFolder = "images/staff"
    >
    > Set objFolder = objFSO.GetFolder(strCurrentFolder)
    >
    > Dim objFile
    >
    > For Each objFile in strCurrentFolder.Files
    > Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    > Next
    >
    > Set objFSO = Nothing
    > Set objFolder = Nothing
    > %>
    >
    > Thanks in advance of any assistance,
    >
    > Andi
    >
    >
    Steven Burn, Mar 23, 2005
    #2
    1. Advertising

  3. Andi B

    Roland Hall Guest

    "Andi B" wrote in message
    news:4241bf6b$0$26751$...
    : For Each objFile in strCurrentFolder.Files

    for each objFile in objFolder.Files

    --
    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, Mar 23, 2005
    #3
  4. Andi B

    Andi B Guest

    For this test, I have set the IUSR account permissions to Full Control, and
    still nothing happens. I'm not sure how I can change the accounts permission
    to access the FileSystemObject though.

    Regards,

    Andi

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > permissions perhaps? The user that IIS is running under doesn't have
    > permission to either the files/folder OR to the FileSsystemObject (most
    > likely this).
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Andi B" <> wrote in message
    > news:4241bf6b$0$26751$...
    >> Hi folks,
    >>
    >> Wondering if anyone can help me - I have recently set up a website on our
    >> work intranet, which allows staff members in our team to attach a photo
    >> of themselves to their profile on the page. The photos are uploaded to
    >> the webserver by an ASP script. I am now trying to get an addition
    >> written which allows for the deletion of old files that are no longer
    >> used by anyones profile. I have written the following to list the
    >> contents of the folder, but whenever I test the script on my home
    >> computer (WinXP Pro, SP2, IIS 5.1) the ASP hangs - it produces no output,
    >> not even an error. Can anyone offer any assistance on what I might need
    >> to do to get it working correctly?
    >>
    >> <%@ Language=VBScript %>
    >>
    >> <%
    >> Option Explicit
    >> Dim objFSO
    >> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    >>
    >> Dim objFolder
    >>
    >> Dim strCurrentFolder
    >> strCurrentFolder = "images/staff"
    >>
    >> Set objFolder = objFSO.GetFolder(strCurrentFolder)
    >>
    >> Dim objFile
    >>
    >> For Each objFile in strCurrentFolder.Files
    >> Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    >> Next
    >>
    >> Set objFSO = Nothing
    >> Set objFolder = Nothing
    >> %>
    >>
    >> Thanks in advance of any assistance,
    >>
    >> Andi
    >>

    >
    >
    Andi B, Mar 23, 2005
    #4
  5. Andi B

    Mark Schupp Guest

    Are you sure it is hanging or could it just not be producing any output?
    What does view source show?

    --
    --Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Andi B" <> wrote in message
    news:4241bf6b$0$26751$...
    > Hi folks,
    >
    > Wondering if anyone can help me - I have recently set up a website on our
    > work intranet, which allows staff members in our team to attach a photo of
    > themselves to their profile on the page. The photos are uploaded to the
    > webserver by an ASP script. I am now trying to get an addition written
    > which allows for the deletion of old files that are no longer used by
    > anyones profile. I have written the following to list the contents of the
    > folder, but whenever I test the script on my home computer (WinXP Pro,
    > SP2, IIS 5.1) the ASP hangs - it produces no output, not even an error.
    > Can anyone offer any assistance on what I might need to do to get it
    > working correctly?
    >
    > <%@ Language=VBScript %>
    >
    > <%
    > Option Explicit
    > Dim objFSO
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    >
    > Dim objFolder
    >
    > Dim strCurrentFolder
    > strCurrentFolder = "images/staff"
    >
    > Set objFolder = objFSO.GetFolder(strCurrentFolder)
    >
    > Dim objFile
    >
    > For Each objFile in strCurrentFolder.Files
    > Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    > Next
    >
    > Set objFSO = Nothing
    > Set objFolder = Nothing
    > %>
    >
    > Thanks in advance of any assistance,
    >
    > Andi
    >
    Mark Schupp, Mar 23, 2005
    #5
  6. Andi B

    Roland Hall Guest

    "Roland Hall" wrote in message
    news:%...
    : "Andi B" wrote in message
    : news:4241bf6b$0$26751$...
    :: For Each objFile in strCurrentFolder.Files
    :
    : for each objFile in objFolder.Files

    Actually you have more than one error. FSO expects a physical path, not
    virtual. You need Server.MapPath and my first suggestion.
    I just tried this and it works. Just change the name of your folders. I'm
    using "/images"

    <%@ Language=VBScript %>
    <%
    Option Explicit
    Response.Buffer = True

    Dim objFSO
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    Dim objFolder

    Dim strCurrentFolder
    strCurrentFolder = Server.MapPath("/images")

    Set objFolder = objFSO.GetFolder(strCurrentFolder)

    Dim objFile

    For Each objFile in objFolder.Files
    Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    Next

    Set objFSO = Nothing
    Set objFolder = Nothing
    %>

    http://kiddanger.com/lab/files3.asp

    --
    Roland Hall
    - some days are easier than others -

    /* 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. */
    Roland Hall, Mar 23, 2005
    #6
  7. Andi B

    Bernard Guest

    If you have antivirus tools installed. such as Norton AV, try disable script
    blocking........

    --
    Regards,
    Bernard Cheah
    http://www.tryiis.com/
    http://support.microsoft.com/
    http://www.msmvps.com/bernard/


    "Andi B" <> wrote in message
    news:4241c88e$0$26739$...
    > For this test, I have set the IUSR account permissions to Full Control,
    > and still nothing happens. I'm not sure how I can change the accounts
    > permission to access the FileSystemObject though.
    >
    > Regards,
    >
    > Andi
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:...
    >> permissions perhaps? The user that IIS is running under doesn't have
    >> permission to either the files/folder OR to the FileSsystemObject (most
    >> likely this).
    >>
    >> --
    >> Curt Christianson
    >> Site & Scripts: http://www.Darkfalz.com
    >> Blog: http://blog.Darkfalz.com
    >>
    >>
    >> "Andi B" <> wrote in message
    >> news:4241bf6b$0$26751$...
    >>> Hi folks,
    >>>
    >>> Wondering if anyone can help me - I have recently set up a website on
    >>> our work intranet, which allows staff members in our team to attach a
    >>> photo of themselves to their profile on the page. The photos are
    >>> uploaded to the webserver by an ASP script. I am now trying to get an
    >>> addition written which allows for the deletion of old files that are no
    >>> longer used by anyones profile. I have written the following to list the
    >>> contents of the folder, but whenever I test the script on my home
    >>> computer (WinXP Pro, SP2, IIS 5.1) the ASP hangs - it produces no
    >>> output, not even an error. Can anyone offer any assistance on what I
    >>> might need to do to get it working correctly?
    >>>
    >>> <%@ Language=VBScript %>
    >>>
    >>> <%
    >>> Option Explicit
    >>> Dim objFSO
    >>> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    >>>
    >>> Dim objFolder
    >>>
    >>> Dim strCurrentFolder
    >>> strCurrentFolder = "images/staff"
    >>>
    >>> Set objFolder = objFSO.GetFolder(strCurrentFolder)
    >>>
    >>> Dim objFile
    >>>
    >>> For Each objFile in strCurrentFolder.Files
    >>> Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    >>> Next
    >>>
    >>> Set objFSO = Nothing
    >>> Set objFolder = Nothing
    >>> %>
    >>>
    >>> Thanks in advance of any assistance,
    >>>
    >>> Andi
    >>>

    >>
    >>

    >
    >
    Bernard, Mar 24, 2005
    #7
  8. Andi B

    Andi B Guest

    Sir you are a genius. Just tested this code and it works brilliantly, thank
    you very much!

    I can't promise that I won't be back asking for more help, but in the mean
    time, thank you.

    Regards,

    Andi

    "Roland Hall" <nobody@nowhere> wrote in message
    news:%232vIrL$...
    > "Roland Hall" wrote in message
    > news:%...
    > : "Andi B" wrote in message
    > : news:4241bf6b$0$26751$...
    > :: For Each objFile in strCurrentFolder.Files
    > :
    > : for each objFile in objFolder.Files
    >
    > Actually you have more than one error. FSO expects a physical path, not
    > virtual. You need Server.MapPath and my first suggestion.
    > I just tried this and it works. Just change the name of your folders.
    > I'm
    > using "/images"
    >
    > <%@ Language=VBScript %>
    > <%
    > Option Explicit
    > Response.Buffer = True
    >
    > Dim objFSO
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    >
    > Dim objFolder
    >
    > Dim strCurrentFolder
    > strCurrentFolder = Server.MapPath("/images")
    >
    > Set objFolder = objFSO.GetFolder(strCurrentFolder)
    >
    > Dim objFile
    >
    > For Each objFile in objFolder.Files
    > Response.Write objFile.Name & " (" & objFile.Size & "bytes)<br>"
    > Next
    >
    > Set objFSO = Nothing
    > Set objFolder = Nothing
    > %>
    >
    > http://kiddanger.com/lab/files3.asp
    >
    > --
    > Roland Hall
    > - some days are easier than others -
    >
    > /* 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. */
    >
    >
    Andi B, Mar 24, 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. Bakes

    Catch script hangs

    Bakes, Sep 27, 2009, in forum: Python
    Replies:
    2
    Views:
    274
    Sean DiZazzo
    Sep 28, 2009
  2. Michael Gebhart

    ruby script using qt hangs

    Michael Gebhart, Oct 6, 2004, in forum: Ruby
    Replies:
    4
    Views:
    125
    Alexander Kellett
    Oct 6, 2004
  3. Adrian Petru Dimulescu

    ruby script hangs on regex match

    Adrian Petru Dimulescu, Jul 22, 2005, in forum: Ruby
    Replies:
    5
    Views:
    240
    William James
    Jul 23, 2005
  4. Tim Shadel

    Gem hangs => TCPSocket.write hangs

    Tim Shadel, Jul 23, 2005, in forum: Ruby
    Replies:
    1
    Views:
    381
    Ville Mattila
    Jul 24, 2005
  5. MiG
    Replies:
    1
    Views:
    82
    Tanaka Akira
    Sep 12, 2005
Loading...

Share This Page