Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
299 lines (280 sloc) 21.2 KB
<Type Name="PageRouteHandler" FullName="System.Web.Routing.PageRouteHandler">
<TypeSignature Language="C#" Value="public class PageRouteHandler : System.Web.Routing.IRouteHandler" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit PageRouteHandler extends System.Object implements class System.Web.Routing.IRouteHandler" />
<TypeSignature Language="DocId" Value="T:System.Web.Routing.PageRouteHandler" />
<TypeSignature Language="VB.NET" Value="Public Class PageRouteHandler&#xA;Implements IRouteHandler" />
<TypeSignature Language="C++ CLI" Value="public ref class PageRouteHandler : System::Web::Routing::IRouteHandler" />
<TypeSignature Language="F#" Value="type PageRouteHandler = class&#xA; interface IRouteHandler" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Web.Routing.IRouteHandler</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<summary>Provides properties and methods for defining how a URL maps to a physical file.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You pass an instance of <xref:System.Web.Routing.PageRouteHandler> to the <xref:System.Web.Routing.Route> constructor in order to map a URL of a physical file. The <xref:System.Web.Routing.PageRouteHandler> object specifies the virtual path of the physical file and determines whether authorization rules for the physical URL is checked.
]]></format>
</remarks>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.Routing.PageRouteHandler" /> class.</summary>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public PageRouteHandler (string virtualPath);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string virtualPath) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Routing.PageRouteHandler.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (virtualPath As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; PageRouteHandler(System::String ^ virtualPath);" />
<MemberSignature Language="F#" Value="new System.Web.Routing.PageRouteHandler : string -&gt; System.Web.Routing.PageRouteHandler" Usage="new System.Web.Routing.PageRouteHandler virtualPath" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="virtualPath" Type="System.String" />
</Parameters>
<Docs>
<param name="virtualPath">The virtual path of the physical file for this <see cref="P:System.Web.Routing.RouteData.Route" /> object. The file must be located in the current application. Therefore, the path must begin with a tilde (~).</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.Routing.PageRouteHandler" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you use this constructor, the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is set to `true`.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <paramref name="virtualPath" /> parameter is <see langword="null" /> or is an empty string or does not start with "~/".</exception>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public PageRouteHandler (string virtualPath, bool checkPhysicalUrlAccess);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string virtualPath, bool checkPhysicalUrlAccess) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Routing.PageRouteHandler.#ctor(System.String,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (virtualPath As String, checkPhysicalUrlAccess As Boolean)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; PageRouteHandler(System::String ^ virtualPath, bool checkPhysicalUrlAccess);" />
<MemberSignature Language="F#" Value="new System.Web.Routing.PageRouteHandler : string * bool -&gt; System.Web.Routing.PageRouteHandler" Usage="new System.Web.Routing.PageRouteHandler (virtualPath, checkPhysicalUrlAccess)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="virtualPath" Type="System.String" />
<Parameter Name="checkPhysicalUrlAccess" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="virtualPath">The virtual path of the physical file of this <see cref="P:System.Web.Routing.RouteData.Route" /> object. The file must be located in the current application. Therefore, the path must begin with a tilde (~).</param>
<param name="checkPhysicalUrlAccess">If this property is set to <see langword="false" />, authorization rules will be applied to the request URL and not to the URL of the physical page. If this property is set to <see langword="true" />, authorization rules will be applied to both the request URL and to the URL of the physical page.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.Routing.PageRouteHandler" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is `true`. Therefore, if you want authorization rules to be applied to both the URL of the physical page and to the route URL, you can use the <xref:System.Web.Routing.PageRouteHandler.%23ctor%28System.String%29> constructor instead of this constructor.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <paramref name="virtualPath" /> parameter is <see langword="null" /> or is an empty string or does not start with "~/".</exception>
<altmember cref="P:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess" />
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
<Member MemberName="CheckPhysicalUrlAccess">
<MemberSignature Language="C#" Value="public bool CheckPhysicalUrlAccess { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CheckPhysicalUrlAccess" />
<MemberSignature Language="DocId" Value="P:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CheckPhysicalUrlAccess As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool CheckPhysicalUrlAccess { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CheckPhysicalUrlAccess : bool" Usage="System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that determines whether authorization rules are applied to the physical file's URL.</summary>
<value>
<see langword="true" /> if authorization is checked for the URL of the physical file that is associated with the route; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can set the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property when you use the <xref:System.Web.Routing.PageRouteHandler.%23ctor%28System.String%2CSystem.Boolean%29> constructor.
The value of the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property determines whether the <xref:System.Web.Routing.PageRouteHandler> object will check security permissions only for the route URL or for both the physical page and the route URL.
When the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is set to `true` (which is its default value), a user must have permission to access both the route URL and the physical URL. When the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is set to `false`, a user requires only permission to access the route URL, and permissions for the physical URL are not checked.
Permissions are defined in the Web.config file, as shown in the following example:
```
<configuration>
<location path="categoriespage.aspx">
<system.web>
<authorization>
<allow roles="admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="category">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
</configuration>
```
For a request URL that contains `Category/food/show` after the domain name, if the route URL pattern is `Category/{action}/{categoryName}` and the physical page is Categoriespage.aspx, [!INCLUDE[vstecasp](~/includes/vstecasp-md.md)] applies the permissions defined in the previous example in one of the following ways:
- If the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is `false`, all users are granted access, because all users are granted access to the URL pattern that starts with `category`.
- If the <xref:System.Web.Routing.PageRouteHandler.CheckPhysicalUrlAccess%2A> property is `true`, only `admin` users are granted access. All users have access to the URL pattern that begins with `category`, but only `admin` users have access to the physical page Categoriespage.aspx.
]]></format>
</remarks>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
<Member MemberName="GetHttpHandler">
<MemberSignature Language="C#" Value="public virtual System.Web.IHttpHandler GetHttpHandler (System.Web.Routing.RequestContext requestContext);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Web.IHttpHandler GetHttpHandler(class System.Web.Routing.RequestContext requestContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Routing.PageRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual System::Web::IHttpHandler ^ GetHttpHandler(System::Web::Routing::RequestContext ^ requestContext);" />
<MemberSignature Language="F#" Value="abstract member GetHttpHandler : System.Web.Routing.RequestContext -&gt; System.Web.IHttpHandler&#xA;override this.GetHttpHandler : System.Web.Routing.RequestContext -&gt; System.Web.IHttpHandler" Usage="pageRouteHandler.GetHttpHandler requestContext" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.IHttpHandler</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="requestContext" Type="System.Web.Routing.RequestContext" />
</Parameters>
<Docs>
<param name="requestContext">An object that encapsulates information about the request.</param>
<summary>Returns the object that processes the request.</summary>
<returns>The object that processes the request.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="requestContext" /> parameter is <see langword="null" />.</exception>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
<Member MemberName="GetSubstitutedVirtualPath">
<MemberSignature Language="C#" Value="public string GetSubstitutedVirtualPath (System.Web.Routing.RequestContext requestContext);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance string GetSubstitutedVirtualPath(class System.Web.Routing.RequestContext requestContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Routing.PageRouteHandler.GetSubstitutedVirtualPath(System.Web.Routing.RequestContext)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::String ^ GetSubstitutedVirtualPath(System::Web::Routing::RequestContext ^ requestContext);" />
<MemberSignature Language="F#" Value="member this.GetSubstitutedVirtualPath : System.Web.Routing.RequestContext -&gt; string" Usage="pageRouteHandler.GetSubstitutedVirtualPath requestContext" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="requestContext" Type="System.Web.Routing.RequestContext" />
</Parameters>
<Docs>
<param name="requestContext">An object that encapsulates information about the request.</param>
<summary>Returns the virtual path of the physical file for the route after substitutions have been applied to any replacement parameters.</summary>
<returns>The URL of the physical file that was generated from a route.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Web.Routing.PageRouteHandler.VirtualPath%2A> value does not contain any replacement parameters, the <xref:System.Web.Routing.PageRouteHandler.GetSubstitutedVirtualPath%2A> method returns the same value as the <xref:System.Web.Routing.PageRouteHandler.VirtualPath%2A> property.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="requestContext" /> parameter is <see langword="null" />.</exception>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
<Member MemberName="VirtualPath">
<MemberSignature Language="C#" Value="public string VirtualPath { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string VirtualPath" />
<MemberSignature Language="DocId" Value="P:System.Web.Routing.PageRouteHandler.VirtualPath" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property VirtualPath As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::String ^ VirtualPath { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.VirtualPath : string" Usage="System.Web.Routing.PageRouteHandler.VirtualPath" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the virtual path of the Web page that is associated with this route.</summary>
<value>The URL of the Web page, before substitutions have been applied for any replacement parameters.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You set the <xref:System.Web.Routing.PageRouteHandler.VirtualPath%2A> property in the <xref:System.Web.Routing.PageRouteHandler.%23ctor%2A?displayProperty=nameWithType> constructor or in the <xref:System.Web.Routing.PageRouteHandler.%23ctor%2A?displayProperty=nameWithType> constructor.
]]></format>
</remarks>
<altmember cref="T:System.Web.Routing.Route" />
<related type="Article" href="https://msdn.microsoft.com/library/892441af-8f1d-483e-ab5f-b82c23576f5a">ASP.NET Routing</related>
<related type="Article" href="https://msdn.microsoft.com/library/200fe812-d0a6-4531-b9b4-cfc4ee83a678">How to: Define Routes for Web Forms Applications</related>
<related type="Article" href="https://msdn.microsoft.com/library/b2decba4-2400-491c-8907-89a7b9e0874c">Walkthrough: Using ASP.NET Routing in a Web Forms Application</related>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.