Roles.CookieSlidingExpiration Propriedade

Definição

Indica se a data e hora de expiração do cookie de nomes de função será redefinida periodicamente.Indicates whether the role names cookie expiration date and time will be reset periodically.

public:
 static property bool CookieSlidingExpiration { bool get(); };
public static bool CookieSlidingExpiration { get; }
member this.CookieSlidingExpiration : bool
Public Shared ReadOnly Property CookieSlidingExpiration As Boolean

Valor da propriedade

Boolean

true se a data e a hora de expiração do cookie de nomes de função serão redefinidas periodicamente; caso contrário, false .true if the role names cookie expiration date and time will be reset periodically; otherwise, false. O padrão é true.The default is true.

Exemplos

O exemplo a seguir mostra o elemento roleManager na system.web seção do arquivo Web.config para um aplicativo ASP.net.The following example shows the roleManager element in the system.web section of the Web.config file for an ASP.NET application. Ele especifica que o aplicativo usa uma SqlRoleProvider instância e define a CookieSlidingExpiration propriedade como false .It specifies that the application uses a SqlRoleProvider instance and sets the CookieSlidingExpiration property to false.

<roleManager defaultProvider="SqlProvider"
  enabled="true"
  cacheRolesInCookie="true"
  cookieName=".ASPROLES"
  cookieTimeout="30"
  cookiePath="/MyApplication"
  cookieRequireSSL="true"
  cookieSlidingExpiration="false"
  cookieProtection="Encrypted" >
  <providers>
    <add
      name="SqlProvider"
      type="System.Web.Security.SqlRoleProvider"
      connectionStringName="SqlServices"
      applicationName="MyApplication" />
  </providers>
</roleManager>

Comentários

Você pode especificar se os nomes de função data e hora de expiração do cookie serão redefinidos com cada resposta usando o cookieSlidingExpiration atributo no arquivo Web.config para seu aplicativo ASP.net.You can specify whether role names cookie expiration date and time will be reset with each response by using the cookieSlidingExpiration attribute in the Web.config file for your ASP.NET application. Se true , a expiração do cookie será inicialmente definida como a data e a hora atuais, além do CookieTimeout em minutos.If true, the cookie expiration will initially be set to the current date and time plus the CookieTimeout in minutes. Enquanto o usuário continua a usar ativamente o aplicativo ASP.NET, a data e a hora de expiração do cookie serão atualizadas automaticamente se houver menos da metade do CookieTimeout restante.While the user continues to actively use the ASP.NET application, the expiration date and time of the cookie will be automatically refreshed if there is less than half of the CookieTimeout remaining. Para obter mais informações, consulte a propriedade Expires.For more information, see the Expires property.

Aplica-se a