Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-31-2005, 04:16 PM   PM User | #1
fuseboxx
New to the CF scene

 
Join Date: Aug 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
fuseboxx is an unknown quantity at this point
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>
fuseboxx is offline   Reply With Quote
Old 08-31-2005, 05:52 PM   PM User | #2
CrzySdrs
Regular Coder

 
Join Date: Jun 2003
Location: Silicon Forest
Posts: 155
Thanks: 0
Thanked 5 Times in 5 Posts
CrzySdrs is an unknown quantity at this point
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?
CrzySdrs is offline   Reply With Quote
Old 08-31-2005, 06:36 PM   PM User | #3
neocool00
Regular Coder

 
Join Date: Sep 2004
Posts: 152
Thanks: 0
Thanked 0 Times in 0 Posts
neocool00 is an unknown quantity at this point
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).
neocool00 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 08:06 PM.


Advertisement
Log in to turn off these ads.