FormsAuthenticationConfiguration.LoginUrl 属性

定义

获取或设置请求的重定向 URL。Gets or sets the redirection URL for the request.

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

属性值

String

当用户未进行身份验证时要将请求重定向到的 URL。The URL the request is redirected to when the user is not authenticated. 默认值为 login.aspx。The default value is login.aspx.

属性

示例

下面的代码示例演示如何访问 LoginUrlThe following code example shows how to access the LoginUrl. 请参阅类主题中的代码示例 FormsAuthenticationConfiguration ,了解如何获取部分。Refer to the code example in the FormsAuthenticationConfiguration class topic to learn how to get the section.

// 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"

注解

LoginUrl当用户未经过身份验证或不存在有效的身份验证 cookie 时,属性指定请求的重定向 URL。The LoginUrl property specifies the redirection URL for the request when the user is not authenticated or when no valid authentication cookie exists.

适用于