Exception class Exception:
<%
Class Exception
Private Iwindow
Private ITarget
Private Itimeout
Private Imode
Private IMessage
Private Ihaserror
Private Iredirect
Public Property Let Window (ByVal Value)
Iwindow = Value
End Property
Public Property Get Window ()
Window = Iwindow
End Property
Public Property Let Target (ByVal Value)
ITarget = Value
End Property
Public Property Get Target ()
Target = ITarget
End Property
Public Property Let TimeOut (ByVal Value)
If IsNumeric (Value) Then
Itimeout = CInt (Value)
Else
Itimeout = 3000
End If
End Property
Public Property Get TimeOut ()
TimeOut = Itimeout
End Property
Public Property Let Mode (ByVal Value)
If IsNumeric (Value) Then
Imode = CInt (Mode)
Else
Imode = 1
End If
End Property
Public Property Get Mode ()
Mode = Imode
End Property
Public Property Let message (ByVal Value)
If Ihaserror Then
IMessage = IMessage & "<li>" & Value & "</li>" & VbCrLf
Else
Ihaserror = True
IMessage = "<li>" & Value & "</li>" & VbCrLf
End If
End Property
Public Property Get Message ()
message = IMessage
End Property
Public Property Let Haserror (ByVal Value)
Ihaserror = CBool (Value)
End Property
Public Property Get Haserror ()
Haserror = Ihaserror
End Property
Public Property Let Redirect (ByVal Value)
Iredirect = CBool (Value)
End Property
Public Property Get Redirect ()
Redirect = Iredirect
End Property
Private Sub Class_Initialize ()
With Me
. window = "Self"
. Target = Prepage ()
. TimeOut = 3000
Imode = 1
IMessage = "Error occurred, returning, please wait ..."
. Haserror = False
. Redirect = True
End With
End Sub
Private Sub Class_Terminate ()
End Sub
Public Function Prepage ()
If Request.ServerVariables ("Http_referer") <> "" Then
Prepage = Request.ServerVariables ("Http_referer")
Else
Prepage = "/index.asp"
End If
End Function
Public Function Alert ()
Dim words:words = Me.message
Words = Replace (words, "<li>", "\ n")
Words = Replace (words, "</li>", "")
Words = Replace (words, VbCrLf, "")
Words = "Prompt info: \t\t\t" & Words
%>
<script type= "Text/javascript" >
<!--
Alert ("<%=words%>")
<%=me.window%>.location = "<%=Me.Target%>"
-->
</script>
<%
End Function
Public Sub Throw ()
If not haserror Then Exit Sub
Response.Clear ()
Select case CInt (Me.mode)
Case 1
%>
<link href= "/css/admin.css" rel= "stylesheet" type= "Text/css" >
<table class= "Border-all" cellspacing= "1" cellpadding= "5" width= "50%" align= "center" border= "0" >
<TBODY>
<TR>
<th height= align= "Middle" background= "Images/th_bg.gif" class= "title" > Hint info </TH>
</TR>
<TR>
<TD align= "center" bgcolor= "#ffffff" height= ">"
<table cellspacing= "0" cellpadding= "0" width= "+" border= "0" >
<TBODY>
<TR>
<TD height= "5" ></TD>
</TR>
<TR>
<TD><%=Me.Message%></TD>
</TR>
<TR>
<TD> </TD>
</TR>
<TR>
<TD align= "center" ><a href= "Javascript:history.back ()" >[back]</a> <a href= "/" >[home page]</a> </TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
<% If Redirect then%> <script type= "Text/javascript" >
<!--
settimeout ("<%=me.window%>.location= ' <%=Me.Target%>" ",<%=me.timeout%>")
-->
</script><%end if%>
<%
Case 2
Call Alert ()
Case Else
Response.Write Message
End Select
Response.End ()
End Sub
End Class
%>