public string GetCsrfToken() { try { if (ExecutingThreadId == 0 || Thread.CurrentThread.ManagedThreadId == ExecutingThreadId) { ExecutingThreadId = Thread.CurrentThread.ManagedThreadId; if (intCsrfParameterName.Length > 0 && LoginReplayAssociations != null) { List <int> ReplayLogIds = LoginReplayAssociations.LogIds; foreach (int ReplayLogId in ReplayLogIds) { Analysis.LogReplayAssociation Asso = LoginReplayAssociations.GetAssociation(ReplayLogId); if (Asso.OriginalAssociation.DestinationLog.LogId >= LoginRequestAsso.DestinationLog.LogId) { if (Asso.ReplayAssociation.DestinationLog.Response != null) { List <string> Values = Asso.ReplayAssociation.DestinationLog.Response.Html.GetValues("input", "name", intCsrfParameterName, "value"); foreach (string Val in Values) { if (Val.Trim().Length > 0) { MostRecentCsrfTokenValue = Val; } } } } } } ExecutingThreadId = 0; ReleaseAllQueues(false); } else { ManualResetEvent MSR = new ManualResetEvent(false); lock (GetCsrfTokenQueue) { GetCsrfTokenQueue.Enqueue(MSR); } MSR.WaitOne(); return(MostRecentCsrfTokenValue); } } catch (Exception Exp) { ReleaseAllQueues(false); throw Exp; } return(MostRecentCsrfTokenValue); }