HttpParseException クラス
アセンブリ: System.Web (system.web.dll 内)


HttpParseException クラスは HTTP 固有の例外クラスで、ASP.NET はこれを使用してパーサー例外情報を出力できます。例外のスローと処理の詳細については、「例外の処理とスロー」を参照してください。

HttpParseException を使用してページの解析中に生成されるエラーをカスタマイズする方法を、次のコード例に示します。この例では、カスタマイズされた HtmlSelect コントロールが定義されます。カスタム コントロールの子要素が指定された型ではない場合、カスタム HtmlSelectBuilder のオーバーライドされた GetChildControlType メソッドで HttpParseException がスローされます。解析例外を生成するには、子要素リテラル MyCustomOption を別の文字列に変更します。
<%@ Page Language="VB"%> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB" Assembly="Samples.AspNet.VB" %> <html > <head runat="server"> <title>HttpParseException Example</title> </head> <body> <form id="Form1" runat="server"> <h3>HttpParseException Example</h3> <aspSample:CustomHtmlSelectWithHttpParseException id="customhtmlselect1" runat="server"> <aspSample:MyCustomOption optionid="option1" value="1"/> <aspSample:MyCustomOption optionid="option2" value="2"/> <aspSample:MyCustomOption optionid="option3" value="3"/> </aspSample:CustomHtmlSelectWithHttpParseException> </form> </body> </html>
<%@ Page Language="C#"%> <%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS" Assembly="Samples.AspNet.CS" %> <html > <head runat="server"> <title>HttpParseException Example</title> </head> <body> <form id="Form1" runat="server"> <h3>HttpParseException Example</h3> <aspSample:CustomHtmlSelectWithHttpParseException id="customhtmlselect1" runat="server"> <aspSample:MyCustomOption optionid="option1" value="1"/> <aspSample:MyCustomOption optionid="option2" value="2"/> <aspSample:MyCustomOption optionid="option3" value="3"/> </aspSample:CustomHtmlSelectWithHttpParseException> </form> </body> </html>
Imports System Imports System.Security.Permissions Imports System.Collections Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Namespace Samples.AspNet.VB ' Define a child control for the custom HtmlSelect. Public Class MyCustomOption Private _id As String Private _value As String Public Property optionid() As String Get Return _id End Get Set(ByVal value As String) _id = value End Set End Property Public Property value() As String Get Return _value End Get Set(ByVal value As String) _value = value End Set End Property End Class ' Define a custom HtmlSelectBuilder. Public Class MyHtmlSelectBuilderWithparseException Inherits HtmlSelectBuilder <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _ Public Overrides Function GetChildControlType(ByVal tagName As String, ByVal attribs As IDictionary) As Type ' Distinguish between two possible types of child controls. If tagName.ToLower().EndsWith("mycustomoption") Then Return GetType(MyCustomOption) Else Throw New HttpParseException("This custom HtmlSelect control" & _ "requires child elements of the form ""MyCustomOption""") End If End Function End Class <ControlBuilderAttribute(GetType(MyHtmlSelectBuilderWithparseException))> _ Public Class CustomHtmlSelectWithHttpParseException Inherits HtmlSelect ' Override the AddParsedSubObject method. Protected Overrides Sub AddParsedSubObject(ByVal obj As Object) Dim _outputtext As String If TypeOf obj Is MyCustomOption Then _outputtext = "custom select option : " + CType(obj, MyCustomOption).value Dim li As New ListItem(_outputtext, CType(obj, MyCustomOption).value) MyBase.Items.Add(li) End If End Sub End Class End Namespace
using System; using System.Security.Permissions; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace Samples.AspNet.CS { // Define a child control for the custom HtmlSelect. public class MyCustomOption { string _id; string _value; public string optionid { get { return _id; } set { _id = value; } } public string value { get { return _value; } set { _value = value; } } } // Define a custom HtmlSelectBuilder. public class MyHtmlSelectBuilderWithparseException : HtmlSelectBuilder { [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)] public override Type GetChildControlType(string tagName, IDictionary attribs) { // Distinguish between two possible types of child controls. if (tagName.ToLower().EndsWith("mycustomoption")) { return typeof(MyCustomOption); } else { throw new HttpParseException("This custom HtmlSelect control" + "requires child elements of the form \"MyCustomOption\""); } } } [ControlBuilderAttribute(typeof(MyHtmlSelectBuilderWithparseException))] public class CustomHtmlSelectWithHttpParseException : HtmlSelect { // Override the AddParsedSubObject method. protected override void AddParsedSubObject(object obj) { string _outputtext; if (obj is MyCustomOption) { _outputtext = "custom select option : " + ((MyCustomOption)obj).value; ListItem li = new ListItem(_outputtext, ((MyCustomOption)obj).value); base.Items.Add(li); } } } }


System.Exception
System.SystemException
System.Runtime.InteropServices.ExternalException
System.Web.HttpException
System.Web.HttpParseException


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpParseException コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpParseException コンストラクタ (String, Exception, String, String, Int32)
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ message As String, _ innerException As Exception, _ virtualPath As String, _ sourceCode As String, _ line As Integer _ )
Dim message As String Dim innerException As Exception Dim virtualPath As String Dim sourceCode As String Dim line As Integer Dim instance As New HttpParseException(message, innerException, virtualPath, sourceCode, line)
public HttpParseException ( string message, Exception innerException, string virtualPath, string sourceCode, int line )
public: HttpParseException ( String^ message, Exception^ innerException, String^ virtualPath, String^ sourceCode, int line )
public HttpParseException ( String message, Exception innerException, String virtualPath, String sourceCode, int line )
public function HttpParseException ( message : String, innerException : Exception, virtualPath : String, sourceCode : String, line : int )

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpParseException コンストラクタ (String, Exception)
アセンブリ: System.Web (system.web.dll 内)

Dim message As String Dim innerException As Exception Dim instance As New HttpParseException(message, innerException)

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpParseException コンストラクタ

名前 | 説明 |
---|---|
HttpParseException () | HttpParseException クラスの新しいインスタンスを初期化します。 |
HttpParseException (String) | 指定したエラー メッセージを使用して、HttpParseException クラスの新しいインスタンスを初期化します。 |
HttpParseException (String, Exception) | 指定したエラー メッセージと内部例外に対する参照を使用して、HttpParseException クラスの新しいインスタンスを初期化します。 |
HttpParseException (String, Exception, String, String, Int32) | コンパイルされていたソース コードに関する情報と例外が発生した行番号を使用して、HttpParseException クラスの新しいインスタンスを初期化します。 |

HttpParseException コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)


HttpException コンストラクタを使用する例を次に示します。作業用の完全なコード例については、HttpParseException の概要トピックを参照してください。

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpParseException プロパティ

名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。 ( Exception から継承されます。) |
![]() | ErrorCode | エラーの HRESULT を取得します。 ( ExternalException から継承されます。) |
![]() | FileName | エラーの発生時に解析されていたファイルの名前を取得します。 |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。 ( Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。 ( Exception から継承されます。) |
![]() | Line | エラーの発生時に解析されていた行の番号を取得します。 |
![]() | Message | 現在の例外を説明するメッセージを取得します。 ( Exception から継承されます。) |
![]() | ParserErrors | 現在の例外の解析エラーを取得します。 |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。 ( Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。 ( Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。 ( Exception から継承されます。) |
![]() | VirtualPath | エラーを生成したソース ファイルへの仮想パスを取得します。 |


HttpParseException メソッド

名前 | 説明 | |
---|---|---|
![]() | CreateFromLastError | Win32 API GetLastError() メソッドから返されるエラー コードに基づいて、新しい HttpException 例外を作成します。 ( HttpException から継承されます。) |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 ( Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetHtmlErrorMessage | クライアントに返す HTML エラー メッセージを取得します。 ( HttpException から継承されます。) |
![]() | GetHttpCode | クライアントに返す HTTP 応答ステータス コードを取得します。 ( HttpException から継承されます。) |
![]() | GetObjectData | オーバーライドされます。 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo オブジェクトを設定します。 |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 ( Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 ( Exception から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

HttpParseException メンバ
HttpParseException データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。(Exception から継承されます。) |
![]() | ErrorCode | エラーの HRESULT を取得します。(ExternalException から継承されます。) |
![]() | FileName | エラーの発生時に解析されていたファイルの名前を取得します。 |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。(Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。(Exception から継承されます。) |
![]() | Line | エラーの発生時に解析されていた行の番号を取得します。 |
![]() | Message | 現在の例外を説明するメッセージを取得します。(Exception から継承されます。) |
![]() | ParserErrors | 現在の例外の解析エラーを取得します。 |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。(Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。(Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。(Exception から継承されます。) |
![]() | VirtualPath | エラーを生成したソース ファイルへの仮想パスを取得します。 |


名前 | 説明 | |
---|---|---|
![]() | CreateFromLastError | Win32 API GetLastError() メソッドから返されるエラー コードに基づいて、新しい HttpException 例外を作成します。 (HttpException から継承されます。) |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 (Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetHtmlErrorMessage | クライアントに返す HTML エラー メッセージを取得します。 (HttpException から継承されます。) |
![]() | GetHttpCode | クライアントに返す HTTP 応答ステータス コードを取得します。 (HttpException から継承されます。) |
![]() | GetObjectData | オーバーライドされます。 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo オブジェクトを設定します。 |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 (Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 (Exception から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からHttpParseExceptionを検索する場合は、下記のリンクをクリックしてください。

- HttpParseExceptionのページへのリンク