CheckPhysicalUrlAccess Property
Collapse the table of content
Expand the table of content

PageRouteHandler.CheckPhysicalUrlAccess Property

.NET Framework 4.6 and 4.5

Gets a value that determines whether authorization rules are applied to the physical file's URL.

Namespace:   System.Web.Routing
Assembly:  System.Web (in System.Web.dll)

member CheckPhysicalUrlAccess : bool with get, private set

Property Value

Type: System.Boolean

true if authorization is checked for the URL of the physical file that is associated with the route; otherwise, false. The default is true.

You can set the CheckPhysicalUrlAccess property when you use the PageRouteHandler(String, Boolean) constructor.

The value of the CheckPhysicalUrlAccess property determines whether the PageRouteHandler object will check security permissions only for the route URL or for both the physical page and the route URL.

When the CheckPhysicalUrlAccess 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 CheckPhysicalUrlAccess 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:

  <location path="categoriespage.aspx">
        <allow roles="admin"/>
        <deny users="*"/>
  <location path="category">
        <allow users="*"/>

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, ASP.NET applies the permissions defined in the previous example in one of the following ways:

  • If the CheckPhysicalUrlAccess property is false, all users are granted access, because all users are granted access to the URL pattern that starts with category.

  • If the CheckPhysicalUrlAccess 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.

.NET Framework
Available since 4.0
Return to top
© 2015 Microsoft