Provides an abstract base class for a page parser filter that is used by the ASP.NET parser to determine whether an item is allowed in the page at parse time.
Namespace:
System.Web.UI
Assembly:
System.Web (in System.Web.dll)
Visual Basic (Declaration)
<PermissionSetAttribute(SecurityAction.LinkDemand, Unrestricted := True)> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted := True)> _
Public MustInherit Class PageParserFilter
Dim instance As PageParserFilter
[PermissionSetAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public abstract class PageParserFilter
[PermissionSetAttribute(SecurityAction::LinkDemand, Unrestricted = true)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Unrestricted = true)]
public ref class PageParserFilter abstract
public abstract class PageParserFilter
The following example demonstrates how you can create a class that derives from the PageParserFilter class to govern the behavior of the ASP.NET page parser. The CustomPageParserFilter is a parser filter that explicitly rejects code in the page. It does this by overriding the AllowCode property.
Namespace Samples.AspNet.VB
<PermissionSet(SecurityAction.Demand, Unrestricted := true)> _
Public Class CustomPageParserFilter
Inherits PageParserFilter
Public Overrides ReadOnly Property AllowCode() As Boolean
Get
Return False
End Get
End Property
End Class
End Namespace
namespace Samples.AspNet.CS
{
[PermissionSet(SecurityAction.Demand, Unrestricted = true)]
public class CustomPageParserFilter : PageParserFilter
{
public override bool AllowCode
{
get
{
return false;
}
}
}
}
To use the CustomPageParserFilter sample, place the class in your App_Code directory. You must configure the ASP.NET parsers to use the filter in the pages section of your site's Web.config configuration file. The following example configuration file shows the configuration for CustomPageParserFilter. When configured to use a parser filter, the ASP.NET parser throws an exception during the build if it encounters code in a page.
<?xml version="1.0" ?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<pages
pageParserFilterType="Samples.AspNet.CS.CustomPageParserFilter">
</pages>
</system.web>
</configuration>
System..::.Object
System.Web.UI..::.PageParserFilter
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference