FormsAuthentication.RequireSSL 屬性

定義

取得值,指出表單驗證 Cookie 是否需要 SSL 才能傳回至伺服器。

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

屬性值

如果表單驗證 Cookie 需要 SSL 才能傳回至伺服器,則為 true,否則為 false。 預設為 false

範例

下列程式碼範例會在 requireSSL Web.config 檔案中設定 屬性。

<authentication mode="Forms">
  <forms loginUrl="member_login.aspx"
    cookieless="UseCookies"
    requireSSL="true"
    path="/MyApplication" />
</authentication>

備註

RequireSSL屬性值是使用 requireSSL表單組態專案的 屬性,在 ASP.NET 應用程式的組態檔中設定。 您可以在 ASP.NET 應用程式的Web.config檔案中指定 SSL (Secure Sockets Layer) 是否需要將表單驗證 Cookie 設定為 屬性,以將表單驗證 Cookie 傳 requireSSL 回至伺服器。 如需詳細資訊,請參閱Secure

如果您將 設定 requireSSL 為 ,則也會將 slidingExpiration 設定為 falsefalse ,以減少票證有效的時間量。

適用於

另請參閱