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

UrlPropertyAttribute クラス

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

コントロールで URL 値を含む文字列プロパティを識別するために使用される属性を定義します。このクラスは継承できません。

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

<AttributeUsageAttribute(AttributeTargets.Property)> _
Public NotInheritable Class
 UrlPropertyAttribute
    Inherits Attribute
Dim instance As UrlPropertyAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] 
public sealed class UrlPropertyAttribute :
 Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] 
public ref class UrlPropertyAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property) */ 
public final class UrlPropertyAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.Property) 
public final class UrlPropertyAttribute extends
 Attribute
解説解説
使用例使用例

URL 固有のプロパティを実装するクラスのコード例を次に示します。このコード例では、UrlPropertyAttribute 属性を CustomHyperLinkControl クラスの TargetUrl プロパティに適用します。この属性は、ASP.NET ファイルに固有のファイル フィルタを設定します。

Public Class CustomHyperLinkControl
    Inherits WebControl

    Public Sub New()
    End Sub 'New

    ' The TargetUrl property represents the URL that 
    ' the custom hyperlink control navigates to.        
    <UrlProperty("*.aspx")> _
    Public Property TargetUrl() As
 String
        Get
            Dim s As String
 = CStr(ViewState("TargetUrl"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("TargetUrl") = value
        End Set
    End Property

    ' The Text property represents the visible text that 
    ' the custom hyperlink control is displayed with.              
  
    Public Overridable Property
 [Text]() As String
        Get
            Dim s As String
 = CStr(ViewState("Text"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("Text") = value
        End Set
    End Property

    ' Implement method to render the control.

End Class 'CustomHyperLinkControl
public class CustomHyperLinkControl : WebControl
{
    public CustomHyperLinkControl() { }

    // The TargetUrl property represents the URL that 
    // the custom hyperlink control navigates to.
    [UrlProperty("*.aspx")]
    public string TargetUrl
    {
        get
        {
            string s = (string)ViewState["TargetUrl"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["TargetUrl"] = value;
        }
    }

    // The Text property represents the visible text that 
    // the custom hyperlink control is displayed with.        
    public virtual string Text
    {
        get
        {
            string s = (string)ViewState["Text"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["Text"] = value;
        }
    }

    // Implement method to render the control.
}
.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.UrlPropertyAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UrlPropertyAttribute メンバ
System.Web.UI 名前空間

UrlPropertyAttribute コンストラクタ ()

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

UrlPropertyAttribute クラスの新しい既定のインスタンスを初期化します。

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

Dim instance As New UrlPropertyAttribute
public UrlPropertyAttribute ()
public:
UrlPropertyAttribute ()
public UrlPropertyAttribute ()
public function UrlPropertyAttribute ()
解説解説

UrlPropertyAttribute クラスの既定のインスタンスは、"*.*" という値に設定された Filter プロパティで初期化されます。

使用例使用例

URL 固有のプロパティを実装するクラスのコード例を次に示します。このコード例では、既定の UrlPropertyAttribute 属性を CustomHyperLinkControl クラスの TargetUrl プロパティに適用します。この属性は、すべての URL をサポートしていることを示し、"*.*" に設定された既定のファイル フィルタを指定しています。

Public Class CustomHyperLinkControl
    Inherits WebControl

    Public Sub New()
    End Sub 'New

    ' The TargetUrl property represents the URL that 
    ' the custom hyperlink control navigates to.        
    <UrlProperty()> _
    Public Property TargetUrl() As
 String
        Get
            Dim s As String
 = CStr(ViewState("TargetUrl"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("TargetUrl") = value
        End Set
    End Property

    ' The Text property represents the visible text that 
    ' the custom hyperlink control is displayed with.        

    Public Overridable Property
 [Text]() As String
        Get
            Dim s As String
 = CStr(ViewState("Text"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("Text") = value
        End Set
    End Property

    ' Implement method to render the control.

End Class 'CustomHyperLinkControl
public class CustomHyperLinkControl : WebControl
{
    public CustomHyperLinkControl() { }

    // The TargetUrl property represents the URL that 
    // the custom hyperlink control navigates to.
    [UrlProperty()]
    public string TargetUrl
    {
        get
        {
            string s = (string)ViewState["TargetUrl"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["TargetUrl"] = value;
        }
    }

    // The Text property represents the visible text that 
    // the custom hyperlink control is displayed with.        
    public virtual string Text
    {
        get
        {
            string s = (string)ViewState["Text"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["Text"] = value;
        }
    }

    // Implement this method to render the control.
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UrlPropertyAttribute クラス
UrlPropertyAttribute メンバ
System.Web.UI 名前空間

UrlPropertyAttribute コンストラクタ (String)

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

UrlPropertyAttribute クラスの新しいインスタンスを初期化し、Filter プロパティを指定した文字列に設定します。

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

Dim filter As String

Dim instance As New UrlPropertyAttribute(filter)
public UrlPropertyAttribute (
    string filter
)
public:
UrlPropertyAttribute (
    String^ filter
)
public UrlPropertyAttribute (
    String filter
)
public function UrlPropertyAttribute (
    filter : String
)

パラメータ

filter

URL 固有のプロパティに関連付けられたファイル フィルタ。

解説解説
使用例使用例

URL 固有のプロパティを実装するクラスのコード例を次に示します。このコード例では、UrlPropertyAttribute 属性を CustomHyperLinkControl クラスの TargetUrl プロパティに適用します。この属性は、ASP.NET ファイルに固有のファイル フィルタを設定します。

Public Class CustomHyperLinkControl
    Inherits WebControl

    Public Sub New()
    End Sub 'New

    ' The TargetUrl property represents the URL that 
    ' the custom hyperlink control navigates to.        
    <UrlProperty("*.aspx")> _
    Public Property TargetUrl() As
 String
        Get
            Dim s As String
 = CStr(ViewState("TargetUrl"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("TargetUrl") = value
        End Set
    End Property

    ' The Text property represents the visible text that 
    ' the custom hyperlink control is displayed with.              
  
    Public Overridable Property
 [Text]() As String
        Get
            Dim s As String
 = CStr(ViewState("Text"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("Text") = value
        End Set
    End Property

    ' Implement method to render the control.

End Class 'CustomHyperLinkControl
public class CustomHyperLinkControl : WebControl
{
    public CustomHyperLinkControl() { }

    // The TargetUrl property represents the URL that 
    // the custom hyperlink control navigates to.
    [UrlProperty("*.aspx")]
    public string TargetUrl
    {
        get
        {
            string s = (string)ViewState["TargetUrl"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["TargetUrl"] = value;
        }
    }

    // The Text property represents the visible text that 
    // the custom hyperlink control is displayed with.        
    public virtual string Text
    {
        get
        {
            string s = (string)ViewState["Text"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["Text"] = value;
        }
    }

    // Implement method to render the control.
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UrlPropertyAttribute クラス
UrlPropertyAttribute メンバ
System.Web.UI 名前空間

UrlPropertyAttribute コンストラクタ

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

名前 説明
UrlPropertyAttribute () UrlPropertyAttribute クラスの新しい既定のインスタンスを初期化します。
UrlPropertyAttribute (String) UrlPropertyAttribute クラスの新しいインスタンスを初期化し、Filter プロパティを指定した文字列に設定します。
参照参照

関連項目

UrlPropertyAttribute クラス
UrlPropertyAttribute メンバ
System.Web.UI 名前空間

UrlPropertyAttribute プロパティ


UrlPropertyAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals オーバーロードされます。 オーバーライドされます。 指定されたオブジェクトが、UrlPropertyAttribute オブジェクトの現在のインスタンスと等しいかどうかを示します。
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。  
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

UrlPropertyAttribute クラス
System.Web.UI 名前空間

UrlPropertyAttribute メンバ

コントロールで URL 値を含む文字列プロパティを識別するために使用される属性を定義します。このクラスは継承できません。

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド UrlPropertyAttribute オーバーロードされます。 UrlPropertyAttribute クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Equals オーバーロードされます。 オーバーライドされます。 指定されたオブジェクトが、UrlPropertyAttribute オブジェクトの現在のインスタンスと等しいかどうかを示します。
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。  
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

UrlPropertyAttribute クラス
System.Web.UI 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「UrlPropertyAttribute」の関連用語

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

   

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



UrlPropertyAttributeのページの著作権

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

©2026 GRAS Group, Inc.RSS