Export (0) Print
Expand All

PageRouteHandler.CheckPhysicalUrlAccess Property

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)

public bool CheckPhysicalUrlAccess { 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:

<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, 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

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft