Actualización: noviembre 2007
Obtiene o establece un valor booleano que determina si durante el procesamiento del recurso incrustado al que hizo referencia la clase WebResourceAttribute, se analizan y se reemplazan otras direcciones URL del recurso Web con la ruta de acceso completa al recurso.
Espacio de nombres:
System.Web.UI
Ensamblado:
System.Web (en System.Web.dll)
Visual Basic (Declaración)
Public Property PerformSubstitution As Boolean
Dim instance As WebResourceAttribute
Dim value As Boolean
value = instance.PerformSubstitution
instance.PerformSubstitution = value
public bool PerformSubstitution { get; set; }
public:
property bool PerformSubstitution {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_PerformSubstitution()
/** @property */
public void set_PerformSubstitution(boolean value)
public function get PerformSubstitution () : boolean
public function set PerformSubstitution (value : boolean)
Valor de propiedad
Tipo:
System..::.Boolean
Es true si los recursos incrustados están resueltos durante el procesamiento del recurso; en caso contrario, es false. El valor predeterminado es false.
Cuando un recurso va del ensamblado a la respuesta, se pueden resolver en este momento las referencias a otros recursos Web en los recursos incrustados, si la propiedad PerformSubstitution se establece en true.
En el ejemplo de código siguiente se muestra la forma de consultar el valor de la propiedad PerformSubstitution. En este ejemplo, se define el atributo WebResourceAttribute del archivo HTML Help.htm con el conjunto de propiedades PerformSubstitution a true.
Este ejemplo de código forma parte de un ejemplo más extenso referente a la clase 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>
A continuación se muestra un ejemplo de un recurso Web HTML que se puede utilizar en este ejemplo. Observe que se utiliza la sintaxis de WebResource cuando establece la propiedad PerformSubstitution en true para el recurso.
<!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 Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
.NET Framework
Compatible con: 3.5, 3.0, 2.0
Referencia