The GIDForums™ Team is proud to announce that
GIDForums™ is now among one of the very first Webmaster / Programming forums to offer a custom-written
Visual Basic Syntax Highlighter BBCode (
[vb] bb code) to it's valued members and readers.
Please use the
[vb] and
[/vb] tag pair to enclose any
visual basic code so that it appears like in the sample effect below:
Sample Effect of [vb] BB Code Tag
VB / Visual Basic Code:
' Example VB code supplied by Microsoft.com
' http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/html/vboriwebformsexampletopics.asp
' Handler in Global.asax file
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Server.Transfer("Errors.aspx")
End Sub
' Handler in Errors.aspx file
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim errMessage As String = ""
Dim appException As System.Exception = Server.GetLastError()
If (TypeOf (appException) Is HttpException) Then
Dim checkException As HttpException = _
CType(appException, HttpException)
Select Case checkException.GetHttpCode
Case 403
errMessage &= "You are not allowed to view that page."
Case 404
errMessage &= "The page you have requested can't be found."
Case 408
errMessage &= "The request has timed out."
Case 500
errMessage &= "The server can't fulfill your request."
Case 503
errMessage &= "The server is experiencing a heavy load."
Case Else
errMessage &= "The server has experienced an error."
End Select
Else
errMessage &= "The following error occurred<BR>" & _
appException.ToString
End If
Label1.Text = errMessage & "<BR>Please contact the server" & _
"administrator."
Server.ClearError()
End Sub