WebService.User 속성

정의

ASP.NET 서버 User 개체를 가져옵니다. 이 속성은 사용자가 요청을 실행할 권한이 있는지 여부를 인증하는 데 사용할 수 있습니다.

public:
 property System::Security::Principal::IPrincipal ^ User { System::Security::Principal::IPrincipal ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Security.Principal.IPrincipal User { get; }
[<System.ComponentModel.Browsable(false)>]
member this.User : System.Security.Principal.IPrincipal
Public ReadOnly Property User As IPrincipal

속성 값

IPrincipal

ASP.NET 서버 IPrincipal 개체를 나타내는 User입니다.

특성

예제

아래 예제에서는 인증 된 사용자 이름을 조회 하 고 해당 이름을 반환 합니다.

<%@ WebService Language="C#" Class="Util" %>
 
 using System.Web.Services;
 
 public class Util: WebService {
      [ WebMethod(Description="Obtains the User Name",EnableSession=false) ]
      public string GetUserName() {
         return User.Identity.Name;
      }
 }
<%@ WebService Language="VB" Class="Util" %>
 
Imports System.Web.Services

Public Class Util
    Inherits WebService
    
    <WebMethod(Description := "Obtains the User Name", _
        EnableSession := False)> _
    Public Function GetUserName() As String
        
        Return User.Identity.Name
    End Function
End Class

설명

인터넷 정보 서비스 (IIS) 및.NET Framework에 대 한 순서로 인증을 위해 구성 해야 합니다 User 속성을 의미 합니다. 인증은 사용자의 자격 증명을 수락 하 고 일부 권한에 대해 해당 자격 증명 유효성 검사 프로세스입니다. 자격 증명 인 유효한 경우 인증된 된 id입니다. .NET Framework에서 인증 web.config 파일에서 항목을 배치 하 여 구성 됩니다.

다음 예제에서는 항목을 Windows 인증을 사용 하도록 설정 하려면 web.config 파일에 배치 합니다.

<security>  
 <authentication mode="Windows"> <!-- Mode Options are Windows, Cookie, Passport and None or Empty String -->  
 </authentication>  
 </security>  

XML 웹 서비스에 대한 보안을 설정하는 방법에 대한 자세한 내용은 ASP.NET 사용하여 만든 XML 웹 서비스 보안 설정을 참조하세요.

적용 대상

추가 정보