HttpParseExceptionとは? わかりやすく解説

HttpParseException クラス

解析エラー発生したときにスローされる例外

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

<SerializableAttribute> _
Public NotInheritable Class
 HttpParseException
    Inherits HttpException
Dim instance As HttpParseException
[SerializableAttribute] 
public sealed class HttpParseException : HttpException
[SerializableAttribute] 
public ref class HttpParseException sealed
 : public HttpException
/** @attribute SerializableAttribute() */ 
public final class HttpParseException extends
 HttpException
SerializableAttribute 
public final class HttpParseException extends
 HttpException
解説解説
使用例使用例

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);
            }
        }      
    }

}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Exception
     System.SystemException
       System.Runtime.InteropServices.ExternalException
         System.Web.HttpException
          System.Web.HttpParseException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpParseException メンバ
System.Web 名前空間
HtmlSelect
HtmlSelectBuilder
その他の技術情報
例外の処理とスロー

HttpParseException コンストラクタ ()


HttpParseException コンストラクタ (String, Exception, String, String, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

コンパイルされていたソース コードに関する情報例外発生した行番号使用して、HttpParseException クラス新しインスタンス初期化します。

名前空間: System.Web
アセンブリ: 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
)

パラメータ

message

エラー発生時に指定する例外メッセージ

innerException

現在の例外の原因である例外innerExceptionnull 参照 (Visual Basic では Nothing) でない場合は、内部例外処理する catch ブロック現在の例外が発生します

virtualPath

例外仮想パス

sourceCode

エラー発生時にコンパイルされていたソース コード

line

例外発生した行番号

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpParseException クラス
HttpParseException メンバ
System.Web 名前空間

HttpParseException コンストラクタ (String, Exception)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したエラー メッセージ内部例外対す参照使用して、HttpParseException クラス新しインスタンス初期化します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    message As String, _
    innerException As Exception _
)
Dim message As String
Dim innerException As Exception

Dim instance As New HttpParseException(message,
 innerException)
public HttpParseException (
    string message,
    Exception innerException
)
public:
HttpParseException (
    String^ message, 
    Exception^ innerException
)
public HttpParseException (
    String message, 
    Exception innerException
)
public function HttpParseException (
    message : String, 
    innerException : Exception
)

パラメータ

message

エラー発生時に指定する例外メッセージ

innerException

現在の例外の原因である例外innerException パラメータnull 参照 (Visual Basic では Nothing) でない場合は、内部例外処理する catch ブロック現在の例外が発生します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpParseException クラス
HttpParseException メンバ
System.Web 名前空間

HttpParseException コンストラクタ


HttpParseException コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したエラー メッセージ使用して、HttpParseException クラス新しインスタンス初期化します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

使用例使用例

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

Throw New HttpParseException("This
 custom HtmlSelect control" & _ 
         "requires child elements of the form ""MyCustomOption""")
throw new HttpParseException("This custom HtmlSelect control"
 +                                                  "requires child elements
 of the form \"MyCustomOption\"");
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpParseException クラス
HttpParseException メンバ
System.Web 名前空間

HttpParseException プロパティ


パブリック プロパティパブリック プロパティ

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

関連項目

HttpParseException クラス
System.Web 名前空間
HtmlSelect
HtmlSelectBuilder

その他の技術情報

例外の処理とスロー

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 から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

HttpParseException クラス
System.Web 名前空間
HtmlSelect
HtmlSelectBuilder

その他の技術情報

例外の処理とスロー

HttpParseException メンバ

解析エラー発生したときにスローされる例外

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


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

関連項目

HttpParseException クラス
System.Web 名前空間
HtmlSelect
HtmlSelectBuilder

その他の技術情報

例外の処理とスロー



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HttpParseException」の関連用語

HttpParseExceptionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpParseExceptionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS