クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
以前のバージョン
.NET Framework SDK 2.0
System.Web.UI
WebResourceAttribute クラス
 PerformSubstitution プロパティ

  低帯域幅での表示をオンにする
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2005/.NET Framework 2.0

その他のバージョンについては、以下の情報を参照してください。
WebResourceAttribute.PerformSubstitution プロパティ
WebResourceAttribute クラスによって参照される埋め込みリソースの処理中に、他の Web リソース URL を解析し、リソースの完全パスに置き換えるかどうかを示すブール値を取得または設定します。

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

Visual Basic (宣言)
Public Property PerformSubstitution As Boolean
Visual Basic (使用法)
Dim instance As WebResourceAttribute
Dim value As Boolean

value = instance.PerformSubstitution

instance.PerformSubstitution = value
C#
public bool PerformSubstitution { get; set; }
C++
public:
property bool PerformSubstitution {
	bool get ();
	void set (bool value);
}
J#
/** @property */
public boolean get_PerformSubstitution ()

/** @property */
public void set_PerformSubstitution (boolean value)
JScript
public function get PerformSubstitution () : boolean

public function set PerformSubstitution (value : boolean)
XAML
適用できません。

プロパティ値

リソースの処理中に埋め込みリソースを解決する場合は true。それ以外の場合は false。既定値は false です。

PerformSubstitution プロパティが true の場合、アセンブリから応答にリソースがストリーム転送されるときに、埋め込みリソース内の他の Web リソースへの参照を解決できます。

PerformSubstitution プロパティの値を照会する方法を次のコード例に示します。この例では、HTML ファイル Help.htm の WebResourceAttribute 属性の PerformSubstitutiontrue に設定されています。

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

Visual Basic
<%@ 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>
C#
<%@ 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>

この例で使用できる HTML Web リソースの例を次に示します。WebResource 構文が使用されていることに注意してください。これは、リソースに対して PerformSubstitution プロパティをtrue に設定した際に使用されます。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html >

<head>

<title>Included Help Page</title>

</head>

<body>

<div>

<img alt="help image" src=<% = WebResource("image1.jpg") %> />

Included help file.

</div>

</body>

</html>

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

.NET Framework

サポート対象 : 3.0,2.0
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker