Roles.CookiePath 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取缓存角色名称的 Cookie 的路径。
public:
static property System::String ^ CookiePath { System::String ^ get(); };
public static string CookiePath { get; }
member this.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。