...

View Full Version : problem with FileExists Function



fuseboxx
08-31-2005, 04:16 PM
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>

CrzySdrs
08-31-2005, 05:52 PM
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.



<%
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

%>

neocool00
08-31-2005, 06:36 PM
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).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum