HttpException コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpException コンストラクタの意味・解説 

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

HTTP 応答ステータス コードエラー メッセージ使用して、HttpException クラス新しインスタンス初期化します。

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

Public Sub New ( _
    httpCode As Integer, _
    message As String _
)
Dim httpCode As Integer
Dim message As String

Dim instance As New HttpException(httpCode,
 message)
public HttpException (
    int httpCode,
    string message
)
public:
HttpException (
    int httpCode, 
    String^ message
)
public HttpException (
    int httpCode, 
    String message
)
public function HttpException (
    httpCode : int, 
    message : String
)

パラメータ

httpCode

エラー対応するクライアント送信されHTTP 応答ステータス コード

message

例外スローされたときに、クライアント表示するエラー メッセージ

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

HttpException コンストラクタ (SerializationInfo, StreamingContext)

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

シリアル化したデータ使用して、HttpException クラス新しインスタンス初期化します。

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

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New HttpException(info,
 context)
protected HttpException (
    SerializationInfo info,
    StreamingContext context
)
protected:
HttpException (
    SerializationInfo^ info, 
    StreamingContext context
)
protected HttpException (
    SerializationInfo info, 
    StreamingContext context
)
protected function HttpException (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

スローされている例外に関するシリアル化済みオブジェクト データ保持している SerializationInfo。

context

転送元または転送先に関すコンテキスト情報保持している StreamingContext。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

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

エラー メッセージ例外コード使用して、HttpException クラス新しインスタンス初期化します。

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

使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますユーザー入力値が 0 の場合HttpException 例外スローさます。

If Num = 0 Then
   Throw New HttpException("No
 value entered", 100)
end if
   
if (Num == 0)
{
   throw new HttpException("No value entered", 100);
}
   
if (num == 0) {
    throw new HttpException("No value entered", 100);
}        
if(num == 0){
   throw new HttpException("No value entered", 100)
}
   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

HttpException コンストラクタ (String)

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

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

使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますユーザー入力値が 0 の場合HttpExceptionスローさます。

If Num = 0 Then
   Throw New HttpException("No
 value entered")
end if
   
if (Num == 0)
{
   throw new HttpException("No value entered");
}
   
if (num == 0) {
    throw new HttpException("No value entered");
}        
if(num == 0){
   throw new HttpException("No value entered")
}
   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

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

HTTP 応答ステータス コードエラー メッセージ、および例外コード使用して、HttpException クラス新しインスタンス初期化します。

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

使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますユーザーが、ユーザー名電子メール情報所定テキスト ボックス入力します。空のテキスト ボックスがある場合HttpException オブジェクト作成されスローさます。HttpExceptionエラー コードが GetHttpCode メソッドによって取得されWeb ページ表示されます。

<html>
   <head>
      <script language="VB" runat="server">
         Sub SubmitButton_Click(sender As Object,
 e As EventArgs)
            Try
               If Textbox1.Text.Length = 0 Or
 Textbox2.Text.Length = 0 Then
                  ' Raise an Exception if the username or emailid field
 is empty.
                  Throw New HttpException(901,
 "User name or e-mail ID not provided", 333)
               Else
                  MyLabel.Text = "Hello " & Textbox1.Text
 & "<br>"
                  MyLabel.Text += "The Weekly newsletter is mailed
 to :" & Textbox2.Text & "<br>"
               End If
            Catch ex As HttpException
               ' Display the error code returned by the GetHttpCode
 method.
               MyLabel.Text = "<h4><font color=red>The
 exception is " & ex.GetHttpCode() & _
                  " - " & ex.Message & "</font></h4>"
            End Try
         End Sub

         Sub Page_Load(sender As Object,
 e As EventArgs)
            MyLabel.Text = ""
         End Sub
      </script>
   </head>

   <body>
      <form runat="server" ID="Form1">
         <h3>HttpException Example</h3>
         Enter User name and E-mail
         <br><br>
         User Name:
         <asp:TextBox ID="Textbox1" Runat="server"></asp:TextBox>
         <br>
         E-mail ID:
         <asp:TextBox ID="Textbox2" Runat="server"></asp:TextBox>
         <asp:Button ID="Button1" Text="Submit"
 OnClick="SubmitButton_Click" runat="server"/>
         <p>
         <asp:label id="MyLabel" runat="server"/>
      </form>
   </body>
</html>
<html>
   <head>
      <script language="C#" runat="server">
         void SubmitButton_Click(Object sender, EventArgs e)
         {
            try
            {
               if(Textbox1.Text.Length==0 || Textbox2.Text.Length==0)
               {
                  // Raise an Exception if the username or the emailfield
 field is empty.
                  throw new HttpException(901,"User name
 or e-mail ID not provided.",333);
               }
               else
               {
                  MyLabel.Text="Hello "+Textbox1.Text+"<br>";
                  MyLabel.Text+="The Weekly newsletter is mailed to :"+
                           Textbox2.Text+"<br>";
               }
            }
            catch(HttpException ex)
            { 
               // Display the error code returned by the GetHttpCode
 method.
               MyLabel.Text="<h4><font color=red>The exception is
 "+
                  ex.GetHttpCode() +" - "+ ex.Message + "</font></h4>";
            }
         }

         void Page_Load(object sender,EventArgs e)
         {
            MyLabel.Text="";
         }
      </script>
   </head>

   <body>
      <form runat="server" ID="Form1">
         <h3>HttpException Example</h3>
         Enter UserName and Email
         <br><br>
         UserName :
         <asp:TextBox ID="Textbox1" Runat="server"></asp:TextBox>
         <br>
         E-mail ID :
         <asp:TextBox ID="Textbox2" Runat="server"></asp:TextBox>
         <asp:Button ID="Button1" Text="Submit" OnClick="SubmitButton_Click"
 runat="server" />
         <p>
         <asp:label id="MyLabel" runat="server" />
      </form>
   </body>
</html>
<html>
   <head>
        <script language="VJ#" runat="server">
        void SubmitButton_Click(Object sender, EventArgs e)
        {
            try {
                if(Textbox1.get_Text().get_Length()==0 || 
                    Textbox2.get_Text().get_Length()==0) {
                    // Raise an Exception if the username or the emailfield
 
                    // field is empty.
                    throw new HttpException(901,"User name
 or e-mail " 
                        + "ID not provided.",333);
                }
                else {
                    MyLabel.set_Text("Hello "+Textbox1.get_Text()+"<br>");
                    MyLabel.set_Text(MyLabel.get_Text() 
                        + "The Weekly newsletter is mailed to :"
                        + Textbox2.get_Text()+"<br>");
                }
            }
            catch(HttpException ex) { 
                // Display the error code returned by the GetHttpCode
 method.
                MyLabel.set_Text("<h4><font color=red>The exception
 is " 
                    + ex.GetHttpCode() +" - "+ ex.get_Message() 
                    + "</font></h4>");
            }
        } //SubmitButton_Click

        void Page_Load(Object sender,EventArgs e)
        {
            MyLabel.set_Text("");
        } //Page_Load
        </script>
   </head>

   <body>
      <form runat="server" ID="Form1">
         <h3>HttpException Example</h3>
         Enter UserName and Email
         <br><br>
         UserName :
         <asp:TextBox ID="Textbox1" Runat="server"></asp:TextBox>
         <br>
         E-mail ID :
         <asp:TextBox ID="Textbox2" Runat="server"></asp:TextBox>
         <asp:Button ID="Button1" Text="Submit" OnClick="SubmitButton_Click"
 runat="server" />
         <p>
         <asp:label id="MyLabel" runat="server" />
      </form>
   </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

HttpException コンストラクタ

HttpException クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
HttpException () HttpException クラス新しインスタンス初期化し、空の HttpException オブジェクト作成します
HttpException (String) 指定したエラー メッセージ使用してHttpException クラス新しインスタンス初期化します。
HttpException (Int32, String) HTTP 応答ステータス コードエラー メッセージ使用してHttpException クラス新しインスタンス初期化します。
HttpException (SerializationInfo, StreamingContext) シリアル化したデータ使用してHttpException クラス新しインスタンス初期化します。
HttpException (String, Exception) エラー メッセージと InnerException プロパティ使用してHttpException クラス新しインスタンス初期化します。
HttpException (String, Int32) エラー メッセージ例外コード使用してHttpException クラス新しインスタンス初期化します。
HttpException (Int32, String, Exception) HTTP 応答ステータス コードエラー メッセージ、および InnerException プロパティ使用してHttpException クラス新しインスタンス初期化します。
HttpException (Int32, String, Int32) HTTP 応答ステータス コードエラー メッセージ、および例外コード使用してHttpException クラス新しインスタンス初期化します。
参照参照

関連項目

HttpException クラス
HttpException メンバ
System.Web 名前空間
InnerException

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

エラー メッセージInnerException プロパティ使用して、HttpException クラス新しインスタンス初期化します。

名前空間: 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 HttpException(message,
 innerException)
public HttpException (
    string message,
    Exception innerException
)
public:
HttpException (
    String^ message, 
    Exception^ innerException
)
public HttpException (
    String message, 
    Exception innerException
)
public function HttpException (
    message : String, 
    innerException : Exception
)

パラメータ

message

例外スローされたときに、クライアント表示するエラー メッセージ

innerException

存在する場合は、現在の例外をスローした InnerException。

解説解説
使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますCheckNumber メソッドは、ユーザーテキスト ボックス入力した値を受け取り、それが整数かどうか確認します。値が整数ない場合例外スローされ、続いて catch ブロック新しHttpException オブジェクト作成されスローさます。この例外Button_Click イベント ハンドラキャッチされ、エラー メッセージブラウザ表示されます。

<html>
   <head>
      <Script language="VB" runat="server">
  
         Sub CheckNumber()
            Try
               ' Check whether the value is an integer.
               Dim convertInt As [String] =
 textbox1.Text
               Convert.ToInt32(convertInt)
            Catch e As Exception
               ' Throw an HttpException object with a message.
               Throw New HttpException("The
 value entered in the textbox is not a integer", e)
            End Try
         End Sub 'CheckNumber
       
         Sub Button_Click(sender As [Object],
 e As EventArgs)
            Try
               CheckNumber()
               label1.Text = "The integer value you entered is:
 " + textbox1.Text
            Catch exp As HttpException
               ' Display the exception thrown.
               label1.Text = "<font color='red'>An HttpException
 was raised!: " + exp.Message + "</font>"
               Dim myInnerException As Exception
 = exp.InnerException
               label2.Text = "InnerException is : "
 + myInnerException.GetType().ToString()
            End Try
         End Sub 'Button_Click
       
         Sub page_load(sender As [Object],
 e As EventArgs)
            label1.Text=""
            label2.Text="" 
         End Sub
      </Script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
      <h3>Example for HttpException</h3>
      <form id="WebForm9" method="post"
 runat="server">
         <b>Enter the value in the text box </b>
         <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
         <br>
         <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server" ID="Button1"></asp:Button>
         <br>
         <b>
         <asp:Label Runat="server" ID="label1"></asp:Label>
         <br>
         <asp:Label Runat="server" ID="label2"></asp:Label>
         </b>
      </form>
      </center>
   </body>
</html>

<html>
   <head>  
      <script language="C#" runat="server">    
         void CheckNumber()
         {
            try
            {
               // Check whether the value is an integer.
               String convertInt= textbox1.Text;
               Convert.ToInt32(convertInt);
            }
            catch(Exception e)
            {
               // Throw an HttpException object with a message.
               throw new HttpException("THe value entered
 in the text box is not a integer", e);
            }
         }
      
         void Button_Click(Object sender, EventArgs e)
         {
            try
            {
               CheckNumber();
               label1.Text = "The integer value you entered is: " + textbox1.Text;
            }
            catch(HttpException exp)
            {
               // Display the exception thrown.
               label1.Text = "<font color='red'>An HttpException was raised:
 " + exp.Message + "</font>";
               Exception myInnerException = exp.InnerException;
               label2.Text = "InnerException is : " + myInnerException.GetType();
            }
         }

         void page_load(Object sender,EventArgs e)
         {
            label1.Text="";
            label2.Text="";
         }
      </script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>Example for HttpException</h3>
      </center>
      <form id="Form1" method="post" runat="server">
         <center>
            <b>Enter the value in the text box </b>
            <br>
            <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
            <br>
            <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server" ID="Button1"></asp:Button>
            <br>
            <b>
               <asp:Label Runat="server" ID="label1"></asp:Label>
               <br>
               <asp:Label Runat="server" ID="label2"></asp:Label>
            </b>
         </center>
      </form>
   </body>
</html>

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

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

HTTP 応答ステータス コードエラー メッセージ、および InnerException プロパティ使用して、HttpException クラス新しインスタンス初期化します。

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

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

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

パラメータ

httpCode

クライアント表示する HTTP 応答ステータス コード

message

例外スローされたときに、クライアント表示するエラー メッセージ

innerException

存在する場合は、現在の例外をスローした InnerException。

解説解説
使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますCheckNumber メソッドは、ユーザー入力した値を受け取り、それが整数かどうか確認します。値が整数ない場合例外スローされ、HTTP 応答ステータス コード例外メッセージ、および内部例外 (ある場合) を含む新しHttpException オブジェクト作成されます。この例外Button_Click イベント ハンドラキャッチされ、エラー メッセージエラー コード、および内部例外表示されます。

<%@ Import Namespace="System.Drawing"
 %>
<html>
   <head>
      <script language="VB" runat="server">
         Sub CheckNumber()
            Try
               'Check whether the value is integer.
               Dim convertInt As [String] =
 textbox1.Text
               Convert.ToInt32(convertInt)
            Catch ex As Exception
               ' Throw an HttpException object that contains the HTTP
 error code,
               ' message, and inner exception.
               Throw New HttpException(500,
 "The entered value is not an integer.", ex)
            End Try
         End Sub
 
         Sub Button_Click(sender As [Object],
 e As EventArgs)
            Try
               CheckNumber()
               label1.Text = "The integer Value you entered is:
 " & textbox1.Text

            Catch exp As HttpException
               ' Display the Exception thrown.
               label1.ForeColor = Color.Red
               label1.Text = "An HttpException was raised: "
 & exp.Message

               Dim myInnerException As Exception
 = exp.InnerException

               ' Display the inner exception.
               label2.Text = "InnerException is : "
 & myInnerException.GetType().ToString()
                
            End Try
         End Sub 

         Sub page_load(sender As [Object],
 e As EventArgs)
            label1.Text = ""
            label2.Text = ""
         End Sub 
      </script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>Example for HttpException</h3>
         <form id="WebForm9" method="post"
 runat="server">
            <b>Enter the value in the text box.</b>
            <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
            <br>
            <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server" ID="Button1"></asp:Button>
            <br>
            <b>
            <asp:Label Runat="server" ID="label1"></asp:Label>
            <br>
            <asp:Label Runat="server" ID="label2"></asp:Label>
            </b>
         </form>
      </center>
   </body>
</html>
<%@ Import Namespace="System.Drawing" %>
<html>
   <head>
      <script language="C#" runat="server">
         void CheckNumber()
         {
            try
            {
               // Check whether the value is an integer.
               String convertInt = textbox1.Text;
               Convert.ToInt32(convertInt);
            }
            catch(Exception ex)
            {
               // Throw an HttpException object that contains the HTTP
 error code,
               // message, and inner exception.
               throw new HttpException(500, "The entered
 value is not an integer.", ex);
            }
         }
         
         void Button_Click(Object sender, EventArgs e)
         {
            try
            {
               CheckNumber();
               label1.Text = "The integer value you entered is: " + textbox1.Text;
            }
            catch(HttpException exp)
            {
               // Display the exception thrown.
               label1.ForeColor = Color.Red;
               label1.Text = "An HttpException was raised!: " + exp.Message;
               Exception myInnerException = exp.InnerException;
               
               // Display the inner exception.
               label2.Text = "The InnerException is : " + myInnerException.GetType();
                
            }
         }
     
         void page_load(Object sender,EventArgs e)
         {
           label1.Text="";
           label2.Text="";
         }

      </script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>Example for HttpException</h3>
         <form id="WebForm9" method="post" runat="server">
            <b>Enter the value in the text box </b>
            <br>
            <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
            <br>
            <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server" ID="Button1"></asp:Button>
            <br>
            <b>
               <asp:Label Runat="server" ID="label1"></asp:Label>
               <br>
               <asp:Label Runat="server" ID="label2"></asp:Label>
            </b>
         </form>
      </center>
   </body>
</html>
<%@ Import Namespace="System.Drawing" %>
<html>
   <head>
    <script language="VJ#" runat="server">
        void CheckNumber() throws HttpException
        {
            try {
                // Check whether the value is an integer.
                String convertInt = textbox1.get_Text();
                Convert.ToInt32(convertInt);
            }
            catch(Exception ex) {
                // Throw an HttpException object that contains the HTTP
 error 
                // code, message, and inner exception.
                throw new HttpException(500, "The entered
 value is not an " 
                    + "integer.", ex);
            }
        } //CheckNumber
        
        void Button_Click(Object sender, EventArgs e)
        {
            try {
                CheckNumber();
                label1.set_Text("The integer value you entered is: " 
                    + textbox1.get_Text());
            }
            catch(HttpException exp) {
                // Display the exception thrown.
                label1.set_ForeColor(Color.get_Red());
                label1.set_Text("An HttpException was raised!: " 
                    + exp.get_Message());
                System.Exception myInnerException = exp.get_InnerException();
                
                // Display the inner exception.
                label2.set_Text("The InnerException is : " 
                    + myInnerException.GetType());
            }
        } //Button_Click
     
        void page_load(Object sender,EventArgs e)
        {
            label1.set_Text("");
            label2.set_Text("");
        } //page_load
      </script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>Example for HttpException</h3>
         <form id="WebForm9" method="post" runat="server">
            <b>Enter the value in the text box </b>
            <br>
            <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
            <br>
            <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server" ID="Button1"></asp:Button>
            <br>
            <b>
               <asp:Label Runat="server" ID="label1"></asp:Label>
               <br>
               <asp:Label Runat="server" ID="label2"></asp:Label>
            </b>
         </form>
      </center>
   </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpException クラス
HttpException メンバ
System.Web 名前空間
InnerException

HttpException コンストラクタ ()

HttpException クラス新しインスタンス初期化し、空の HttpException オブジェクト作成します

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

public HttpException ()
public:
HttpException ()
public HttpException ()
public function HttpException ()
解説解説
使用例使用例

HttpException クラスHttpException コンストラクタコード例次に示しますCheckNumber メソッドは、ユーザーテキスト ボックス入力した値を受け取り、それが整数かどうか確認します。値が整数ない場合例外スローされ、続いて新しHttpException オブジェクト作成されスローさます。この例外Button_Click イベント ハンドラキャッチされ、エラー メッセージブラウザ表示されます。

<html>
   <head>
      <script language="VB" runat="server">
         Sub CheckNumber()
            Try
               ' Check whether the value is an integer.
               Dim convertInt As [String] =
 textbox1.Text
               Convert.ToInt32(convertInt)
            Catch e As Exception
               ' Throw the 'HttpException' object.
               Throw New HttpException()
            End Try
         End Sub 'CheckNumber
 
         Sub Button_Click(sender As [Object],
 e As EventArgs)
            Try
               CheckNumber()
               label1.Text = "The integer value you entered is:
 " + textbox1.Text
            Catch exp As HttpException
               label1.Text = "<font color='red'>An HttpException
 was raised!:" _
                  & " The value entered in the textbox is
 not an integer</font>"
            End Try
         End Sub 'Button_Click
       
         Sub Page_Load(sender As [Object],
 e As EventArgs)
            label1.Text=""
         End Sub
      </script>
   </head>

   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>Example for HttpException</h3>
      </center>
      <form id="WebForm9" method="post"
 runat="server">
         <center>
            <b>Enter a value in the text box.</b>
            <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
            <br>
            <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server"></asp:Button>
            <br>
            <b><asp:Label Runat="server"
 ID="label1"></asp:Label></b>
         </center>
      </form>
   </body>
</html>
<html>
   <head>
      <script language="C#" runat="server">
         void CheckNumber()
         {
            try
            {
               // Check whether the value is an integer.
               String convertInt = textbox1.Text;
               Convert.ToInt32(convertInt);
            }
            catch(Exception e)
            {
               // Throw a 'HttpException' object.
               throw new HttpException();
            }
         }
      
         void Button_Click(Object sender, EventArgs e)
         {
            try
            {
               CheckNumber();
               label1.Text = "The integer value you entered is: "+textbox1.Text;
            }
            catch(HttpException exp)
            {
               label1.Text = "<font color='red'>An HttpException was raised!:"
                  + " The value entered in the textbox is
 not an integer.</font>";
            }
         }

         void page_load(object sender,EventArgs e)
         {
            label1.Text="";
         }
      </script>
   </head>
   
   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>
            Example for HttpException
         </h3>
      </center>
      
      <form id="WebForm9" method="post" runat="server">
         <center>
         <br>
         <b>Enter a value in the text box.</b>
         <br>
         <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
         <br>
         <asp:Button Text="Click Here" OnClick="Button_Click"
 Runat="server"></asp:Button>
         <br>
         <b><asp:Label Runat="server" ID="label1"></asp:Label></b>
         </center>
      </form>
   </body>
</html>
<html>
   <head>
        <script language="VJ#" runat="server">
            void CheckNumber() throws HttpException
            {
                try {
                    // Check whether the value is an integer.
                    String convertInt = textbox1.get_Text();
                    Convert.ToInt32(convertInt);
                }
                catch(Exception e) {
                    // Throw a 'HttpException' object.
                    throw new HttpException();
                }
            } //CheckNumber
          
            void Button_Click(Object sender, EventArgs e)
            {
                try {
                    CheckNumber();
                    label1.set_Text("The integer value you entered is: "
 
                        + textbox1.get_Text());
                }
                catch(HttpException exp)
                {
                    label1.set_Text("<font color='red'>An HttpException
 was raised!:"
                        + " The value entered in the textbox
 is not an " 
                        + "integer.</font>");
                }
            } //Button_Click

            void page_load(Object sender,EventArgs e)
            {
                label1.set_Text("");
            } //page_load
      </script>
   </head>
   
   <body MS_POSITIONING="GridLayout">
      <center>
         <h3>
            Example for HttpException
         </h3>
      </center>
      
      <form id="WebForm9" method="post" runat="server">
         <center>
         <br>
         <b>Enter a value in the text box.</b>
         <br>
         <asp:TextBox Runat="server" ID="textbox1"></asp:TextBox>
         <br>
         <asp:Button ID="Button1" Text="Click Here" OnClick="Button_Click"
 Runat="server"></asp:Button>
         <br>
         <b><asp:Label Runat="server" ID="label1"></asp:Label></b>
         </center>
      </form>
   </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpException クラス
HttpException メンバ
System.Web 名前空間
InnerException


このページでは「.NET Framework クラス ライブラリ リファレンス」からHttpException コンストラクタを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHttpException コンストラクタを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHttpException コンストラクタを検索

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

辞書ショートカット

すべての辞書の索引

「HttpException コンストラクタ」の関連用語

HttpException コンストラクタのお隣キーワード
検索ランキング

   

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



HttpException コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS