Share via


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 屬性,但通常會在應用程式組態檔中設定值。 這可讓您變更服務位置,而不需重新編譯程式碼。

適用於

另請參閱