Roles.CookieRequireSSL 属性
定义
获取一个值,该值指示角色名称 Cookie 是否需要 SSL 以便返回到服务器。Gets a value indicating whether the role names cookie requires SSL in order to be returned to the server.
public:
static property bool CookieRequireSSL { bool get(); };
public static bool CookieRequireSSL { get; }
member this.CookieRequireSSL : bool
Public Shared ReadOnly Property CookieRequireSSL As Boolean
属性值
如果需要 SSL 以便将角色名称 Cookie 返回到服务器,则为 true;否则为 false。true if SSL is required to return the role names cookie to the server; otherwise, false. 默认值为 false。The default is false.
示例
下面的示例显示了 system.web ASP.NET 应用程序 Web.config 文件的部分中的 roleManager 元素。The following example shows the roleManager element in the system.web section of the Web.config file for an ASP.NET application. 它指定应用程序使用 SqlRoleProvider 实例,并将设置 cookieRequireSSL 为 true 。It specifies that the application uses a SqlRoleProvider instance and sets cookieRequireSSL to true.
<roleManager defaultProvider="SqlProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/MyApplication"
cookieRequireSSL="true"
cookieSlidingExpiration="true"
cookieProtection="Encrypted" >
<providers>
<add
name="SqlProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="SqlServices"
applicationName="MyApplication" />
</providers>
</roleManager>
注解
通过 cookieRequireSSL 在 ASP.NET 应用程序的 Web.config 文件中设置属性,可以指定是否需要 SSL (安全套接字层) 将角色名称 cookie 返回到应用程序中的服务器。You can specify whether SSL (Secure Sockets Layer) is required to return the role names cookie to the server in your application by setting the cookieRequireSSL attribute in the Web.config file for your ASP.NET application. 有关详细信息,请参阅 Secure。For more information, see Secure.