Roles.CookiePath 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取缓存的角色名称 Cookie 的路径。
public:
static property System::String ^ CookiePath { System::String ^ get(); };
public static string CookiePath { get; }
static member CookiePath : string
Public Shared ReadOnly Property CookiePath As String
属性值
缓存角色名称的 Cookie 的路径。 默认值为 /。
示例
以下示例显示了 ASP.NET 应用程序的 Web.config 文件中 的 roleManager 元素 system.web 。 它指定应用程序使用 SqlRoleProvider 实例并将属性设置为 cookiePath /MyApplication。
<roleManager defaultProvider="SqlProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/MyApplication"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<add
name="SqlProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="SqlServices"
applicationName="MyApplication" />
</providers>
</roleManager>
注解
通过在 ASP.NET 应用程序的 Web.config 文件中设置 cookiePath 属性,可以指定为应用程序缓存角色的 Cookie 路径。 有关 Cookie 路径的详细信息,请参阅 Path。