Catch HttpException : HttpException « Development « ASP.NET Tutorial

Home
ASP.NET Tutorial
1.ASP.Net Instroduction
2.Language Basics
3.ASP.net Controls
4.HTML Controls
5.Page Lifecycle
6.Response
7.Collections
8.Validation
9.Development
10.File Directory
11.Sessions
12.Cookie
13.Cache
14.Custom Controls
15.Profile
16.Configuration
17.LINQ
18.ADO.net Database
19.Data Binding
20.Ajax
21.Authentication Authorization
22.I18N
23.Mobile
24.WebPart
25.XML
ASP.NET Tutorial » Development » HttpException 
9.28.1.Catch HttpException
<%@ Page Language="vb" EnableSessionState="false" %>
<html>
<head>
   <script runat="server">
      Sub Page_Load()
         Try
            Session("foo""Foo"
         Catch HttpEx As HttpException
            Message.Text = "ERROR:</br>"
            Message.Text &= "Message: " & HttpEx.Message & "</br>"
            Message.Text &= "Help Link: " & HttpEx.HelpLink & "</br>"
            Message.Text &= "Error Code: " & HttpEx.ErrorCode & "</br>"
            Message.Text &= "Source: " & HttpEx.Source & "</br>"
            Message.Text &= "Stack Trace: " & HttpEx.StackTrace & "</br>"
            Message.Text &= "Target Site: " & HttpEx.TargetSite.ToString() "</br>"
            Message.Text &= "Http Error Message: " & HttpEx.GetHtmlErrorMessage() "</br>"
            Message.Text &= "Http Error Code: " & HttpEx.GetHttpCode() "</br>"
            Message.Text &= "String: " & HttpEx.ToString() "</br>"
         End Try
      End Sub
   </script>
</head>
<body>
   <asp:label id="Message" forecolor="red" runat="server"/>
</body>
</html>
9.28.HttpException
9.28.1.Catch HttpException
9.28.2.HttpException("Threw an error from Page_Load", 100)
9.28.3.Get base exception
9.28.4.Get error message
9.28.5.GetHttpCode
9.28.6.HelpLink
9.28.7.InnerException
9.28.8.Exception Message
9.28.9.Source of exception
9.28.10.Stack trace
9.28.11.Target site
9.28.12.Convert Exception to string
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.