Exception class exception

Source: Internet
Author: User
Tags servervariables

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>
&LT;TD align= "center" bgcolor= "#ffffff" height= ">"
<table cellspacing= "0" cellpadding= "0" width= "+" border= "0" >
<TBODY>
<TR>
&LT;TD height= "5" ></TD>
</TR>
<TR>
<TD><%=Me.Message%></TD>
</TR>
<TR>
<TD> </TD>
</TR>
<TR>
&LT;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
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.