Clase WindowsAuthentication
Proporciona una implementación de servicios de autenticación que efectúa autenticación de Windows con una clase DomainContext que se genera a partir de un servicio de dominio que implementa la interfaz IAuthentication.
Espacio de nombres: System.ServiceModel.DomainServices.Client.ApplicationServices
Ensamblado: System.ServiceModel.DomainServices.Client.Web (en system.servicemodel.domainservices.client.web.dll)
Uso
'Uso
Dim instance As WindowsAuthentication
Sintaxis
'Declaración
Public Class WindowsAuthentication
Inherits WebAuthenticationService
public class WindowsAuthentication : WebAuthenticationService
public ref class WindowsAuthentication : public WebAuthenticationService
public class WindowsAuthentication extends WebAuthenticationService
public class WindowsAuthentication extends WebAuthenticationService
Notas
Para configurar la aplicación de forma que use autenticación de Windows, es preciso que establezca valores en el proyecto de servidor y en el de cliente. Se utiliza la clase WindowsAuthentication cuando se establece el valor en el proyecto de cliente.
En el archivo Web.config del proyecto del servidor, establezca el modo de autenticación en “Windows”
, tal como se muestra en el ejemplo siguiente.
<system.web>
<authentication mode="Windows"></authentication>
</system.web>
En el constructor del objeto Application para la aplicación cliente, establezca la propiedad Authentication del objeto WebContext en WindowsAuthentication, tal como se muestra en el ejemplo siguiente. El constructor se encuentra por lo general en un archivo denominado App.xaml.cs o App.xaml.vb.
Public Sub New()
InitializeComponent()
Dim webContext As New WebContext()
'webContext.Authentication = New FormsAuthentication()
webContext.Authentication = New WindowsAuthentication()
Me.ApplicationLifetimeObjects.Add(webContext)
End Sub
public App()
{
InitializeComponent();
WebContext webContext = new WebContext();
//webContext.Authentication = new FormsAuthentication();
webContext.Authentication = new WindowsAuthentication();
this.ApplicationLifetimeObjects.Add(webContext);
}
Jerarquía de herencia
System.Object
System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationService
System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService
System.ServiceModel.DomainServices.Client.ApplicationServices.WindowsAuthentication
Seguridad para subprocesos
Cualquier miembro estático público (Compartidos en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.
Plataformas
Plataformas de desarrollo
Microsoft Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008 y Windows 2000
Plataformas de destino
Change History
Vea también
Referencia
Miembros WindowsAuthentication
Espacio de nombres System.ServiceModel.DomainServices.Client.ApplicationServices