共用方式為


FormsAuthenticationConfiguration.LoginUrl 屬性

定義

取得或設定請求的重定向網址。

public:
 property System::String ^ LoginUrl { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("loginUrl", DefaultValue="login.aspx")]
[System.Configuration.StringValidator(MinLength=1)]
public string LoginUrl { get; set; }
[<System.Configuration.ConfigurationProperty("loginUrl", DefaultValue="login.aspx")>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.LoginUrl : string with get, set
Public Property LoginUrl As String

屬性值

當使用者未被驗證時,請求會被重新導向的網址。 預設值為login.aspx。

屬性

範例

以下程式碼範例說明如何存取 LoginUrl。 參考課堂主題中的 FormsAuthenticationConfiguration 程式碼範例,了解如何取得該章節。

// Get the current LoginUrl.
string currentLoginUrl = formsAuthentication.LoginUrl;

// Set the LoginUrl.
formsAuthentication.LoginUrl = "newLoginUrl";
' Get the current LoginUrl.
Dim currentLoginUrl As String =
formsAuthentication.LoginUrl

' Set the LoginUrl. 
formsAuthentication.LoginUrl = "newLoginUrl"

備註

當使用者未被認證或無有效的認證 Cookie 存在時,該 LoginUrl 屬性指定請求的重定向 URL。

適用於

另請參閱