Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem with FileExists Function

    I'm trying to check to see If my url variable exists on the server before setting my page to open in a frameset. I'm using the FileExists object with the code below and I'm still throwing a server 500 error.

    Not sure what I'm missing here............anyone have any thoughts?


    -----------------------------------------------------------------------

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

    If objFSO.FileExists(URL) Then
    URL = <%= URL %>
    Else
    URL = "whatsnew.htm"
    End If
    %>

    <html>
    <head>
    <title>test page </title>
    </head>
    <frameset framespacing="0" border="false" frameborder="0" rows="85,*">
    <frame name="top" scrolling="no" src="top.htm"

    marginwidth="0" marginheight="0" target="main">
    <frame name="main" src="<%= URL %>">

    <noframes>
    <body>
    text Here
    </body>
    </noframes>
    </frameset>
    </html>

  • #2
    Regular Coder
    Join Date
    Jun 2003
    Location
    Silicon Forest
    Posts
    155
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Not sure what you are trying to do... but FileExists only would work on local objects so you need to give a full path name on your local website.

    Code:
    <%
    Dim objFSO
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    
    'Url Must Be Set To Something, I will assume its your querystring
    URL = request.querystring("URL")
    
    If objFSO.FileExists(Server.mappath(URL)) Then
       URL = URL
    Else
       URL = "/whatsnew.htm"
    End If
    
    %>
    Whats the point of a signature?

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Another option for doing this if you have access to the IIS properties of the server is to create a custom 404 page (404 is page/file not found, 500 is code error).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •