Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternat 404 error page (single use)

Status
Not open for further replies.

HardHat

IS-IT--Management
Aug 7, 2003
14
US
Hi,

I have the following 2 asp pages that creates a link to a file depending on text entered by the user. What I need to do, is check that the link created is valid (is the filename exists) and display an alternate message screen if the link create disn't valid (asking the user to either re-enter the information, or connact their IT representative if they are sure they entered the correct information).

Is there a way of doing this (or using an alternate 404 error page for this link only ?).

EntryScreen.asp

<form action="get_install.asp" method="post" name="theForm" id="theForm">
<p align="center">
<IMG height=80 src="IPClogo.gif" width=137 border=0></p>
<p align="center"><b><font size="4" face="Arial">Download Mac based MS Outlook configuration package</font></b></p>
<p align="left"><b><font face="Arial" size="6">
</font><font face="Arial" size="2">
</font><font face="Arial">Screen name</font><font face="Arial" size="2">
</font></b><font face="Arial"><input name="cdid" id="cdid" ></font></p>
<p align="left"><font face="Arial">


get_install.asp :

<%

dim file, static_path

file = request.form("cdid") & ".hqx"
static_path = "installs/"

with response
.write("<a href=""" & static_path & file & """>Click to download configuration file</a>")
end with
%>


Thanks for any help/advice

 
You shouldnt need a 404 page if the page isnt valid. Just dont display a link to it.

The following code can be used to check if a file exists on the server.
Code:
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(Server.MapPath(static_path & file)) Then
  Response.Write "<a href=""" & static_path & file & """>Click to download configuration file</a>"  
Else
  'file doesnt exist
End If

Set objFSO = Nothing

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Thanks Tony, this worked a treat !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top