ClientFormsAuthenticationMembershipProvider.ServiceUri 属性

定义

获取或设置身份验证服务的 URI。

public:
 property System::String ^ ServiceUri { System::String ^ get(); void set(System::String ^ value); };
public string ServiceUri { get; set; }
member this.ServiceUri : string with get, set
Public Property ServiceUri As String

属性值

身份验证服务 URI。

例外

获取此属性时,未在应用程序配置文件中发现任何服务 URI,并且以前未设置过此属性。

示例

以下示例代码演示如何使用此属性以编程方式设置身份验证服务位置。 以编程方式设置服务位置时,必须指定完整的服务 URI,该 URI 始终以“Authentication_JSON_AppService.axd”结尾。

private void SetAuthenticationServiceLocation()
{
    ((ClientFormsAuthenticationMembershipProvider)
        System.Web.Security.Membership.Provider).ServiceUri =
        "http://localhost:55555/AppServices/Authentication_JSON_AppService.axd";
}
Private Sub SetAuthenticationServiceLocation()
    CType(System.Web.Security.Membership.Provider,  _
        ClientFormsAuthenticationMembershipProvider).ServiceUri = _
        "http://localhost:55555/AppServices/Authentication_JSON_AppService.axd"
End Sub

注解

可以在应用程序代码中设置 ServiceUri 属性,但通常会在应用程序配置文件中设置值。 这使你无需重新编译代码即可更改服务位置。

适用于

另请参阅