AnonymousIdentificationEventHandler Delegat

Definicja

Reprezentuje metodę, która obsługuje zdarzenie AnonymousIdentification_Creating obiektu 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)

Parametry

sender
Object

Źródło zdarzenia.

Przykłady

W poniższym przykładzie kodu użyto zdarzenia AnonymousIdentification_Creating w celu ustawienia identyfikatora anonimowego na wartość niestandardową.

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

Uwagi

Delegat AnonymousIdentificationEventHandler jest zdefiniowany dla Creating zdarzenia AnonymousIdentificationModule klasy. Dostęp do zdarzenia AnonymousIdentificationModule klasy można uzyskaćCreating, określając podproceduty o nazwie AnonymousIdentification_Creating w pliku Global.asax dla aplikacji ASP.NET. Zdarzenie Creating jest zgłaszane podczas PostAuthenticateRequest zdarzenia.

Obiekt AnonymousIdentificationModule tworzy AnonymousIdentificationEventArgs obiekt przy użyciu prądu HttpContext i przekazuje go do zdarzenia AnonymousIdentification_Creating .

Możesz użyć AnonymousID właściwości obiektu dostarczonego AnonymousIdentificationEventArgs do zdarzenia AnonymousIdentification_Creating , aby ustawić identyfikator anonimowy na wartość niestandardową. Jeśli nie określisz wartości właściwości AnonymousID podczas zdarzenia AnonymousIdentification_Creating , zostanie użyta Guid wartość .

Zdarzenie AnonymousIdentification_Creating jest zgłaszane tylko wtedy, gdy identyfikacja anonimowa polega Enabled na <ustawieniu elementu konfiguracji anonymousIdentification> na truewartość .

Metody rozszerzania

GetMethodInfo(Delegate)

Pobiera obiekt reprezentujący metodę reprezentowaną przez określonego delegata.

Dotyczy