AnonymousIdentificationEventHandler Delegar

Definição

Representa o método que lida com o evento AnonymousIdentification_Creating de um AnonymousIdentificationModule.

public delegate void AnonymousIdentificationEventHandler(System::Object ^ sender, AnonymousIdentificationEventArgs ^ e);
public delegate void AnonymousIdentificationEventHandler(object sender, AnonymousIdentificationEventArgs e);
type AnonymousIdentificationEventHandler = delegate of obj * AnonymousIdentificationEventArgs -> unit
Public Delegate Sub AnonymousIdentificationEventHandler(sender As Object, e As AnonymousIdentificationEventArgs)

Parâmetros

sender
Object

A origem do evento.

Exemplos

O seguinte exemplo de código utiliza o evento AnonymousIdentification_Creating para definir o identificador anónimo para um valor personalizado.

public void AnonymousIdentification_Creating(object sender, 
                                             AnonymousIdentificationEventArgs args)
{
  args.AnonymousID = Samples.AspNet.Security.MyIdClass.GetAnonymousId();
  Samples.AspNet.Security.MyIdClass.LogAnonymousId(args.AnonymousID);
}
Public Sub AnonymousIdentification_Creating(sender As Object,  _
                                            args As AnonymousIdentificationEventArgs)
  args.AnonymousID = Samples.AspNet.Security.MyIdClass.GetAnonymousId()
  Samples.AspNet.Security.MyIdClass.LogAnonymousId(args.AnonymousId)
End Sub

Observações

O AnonymousIdentificationEventHandler delegado é definido para o Creating evento da AnonymousIdentificationModule turma. Pode aceder ao evento Creating da classe AnonymousIdentificationModule especificando uma sub-rotina chamada AnonymousIdentification_Creating no ficheiro Global.asax da sua aplicação ASP.NET. O Creating evento é levantado durante o PostAuthenticateRequest evento.

O AnonymousIdentificationModule objeto constrói um AnonymousIdentificationEventArgs objeto usando a corrente HttpContext e passa-a para o evento AnonymousIdentification_Creating .

Pode usar a AnonymousID propriedade do AnonymousIdentificationEventArgs objeto fornecida ao evento AnonymousIdentification_Creating para definir o identificador anónimo para um valor personalizado. Se não especificar um valor para a AnonymousID propriedade durante o evento AnonymousIdentification_Creating , é usado a Guid .

O evento AnonymousIdentification_Creating só é ativado quando a identificação anónima é Enabled definida ao definir o <elemento de configuração anonymousIdentification> como true.

Métodos da Extensão

Name Description
GetMethodInfo(Delegate)

Obtém um objeto que representa o método representado pelo delegado especificado.

Aplica-se a