WebResourceAttribute.ContentType プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebResourceAttribute.ContentType プロパティの意味・解説 

WebResourceAttribute.ContentType プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

WebResourceAttribute クラスによって参照されるリソースMIME タイプ格納する文字列取得します

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

解説解説
使用例使用例

ContentType プロパティの値を照会する方法次のコード例示します

このコード例は、WebResourceAttribute クラストピック取り上げているコード例一部分です。

<%@ Page Language="VB" %>
<%@ Register TagPrefix="AspNetSamples" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB.Controls"
 %>
<%@ Import Namespace="System.Reflection"
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Page_Load(ByVal
 sender As Object, ByVal
 e As System.EventArgs)

    ' Get the assembly metatdata.
    Dim clsType As Type = GetType(MyCustomControl)
    Dim a As Assembly =
 clsType.Assembly
    
    For Each attr As Attribute
 In Attribute.GetCustomAttributes(a)
      'Check for WebResource attributes.
      If attr.GetType() Is GetType(WebResourceAttribute)
 Then
        Dim wra As WebResourceAttribute = CType(attr,
 WebResourceAttribute)
        Response.Write("Resource in the assembly: "
 & wra.WebResource.ToString() & _
        " with ContentType = " & wra.ContentType.ToString()
 & _
        " and PerformsSubstitution = " & wra.PerformSubstitution.ToString()
 & "</br>")
      End If
    Next attr
    
    
  End Sub
  
</script>

<html  >
<head runat="server">
    <title>WebResourceAttribute Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <AspNetSamples:MyCustomControl ID="MyCustomControl1"
 runat="server">
      </AspNetSamples:MyCustomControl>    
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ Register TagPrefix="AspNetSamples" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS.Controls" %>
<%@ Import Namespace="System.Reflection" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Page_Load(object sender, EventArgs
 e)
  {
            
    // Get the assembly metatdata.
    Type clsType = typeof(MyCustomControl);
    Assembly a = clsType.Assembly;

    // Iterate through the attributes for the assembly.
    foreach (Attribute attr in Attribute.GetCustomAttributes(a))
    {
      //Check for WebResource attributes.
      if (attr.GetType() == typeof(WebResourceAttribute))
      {
        WebResourceAttribute wra = (WebResourceAttribute)attr;
        Response.Write("Resource in the assembly: "
 + wra.WebResource.ToString() +
          " with ContentType = " + wra.ContentType.ToString() +
          " and PerformsSubstitution = " + wra.PerformSubstitution.ToString()
 + "</br>");
      }
    }
  }
</script>

<html  >
<head runat="server">
    <title>WebResourceAttribute Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <AspNetSamples:MyCustomControl ID="MyCustomControl1" runat="server">
      </AspNetSamples:MyCustomControl>    
    </div>
    </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebResourceAttribute クラス
WebResourceAttribute メンバ
System.Web.UI 名前空間
GetWebResourceUrl


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

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

辞書ショートカット

すべての辞書の索引

WebResourceAttribute.ContentType プロパティのお隣キーワード
検索ランキング

   

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



WebResourceAttribute.ContentType プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS