protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { // Display results view MultiView1.SetActiveView(View2); NoBotState state; Label1.Text = string.Format( (NoBot1.IsValid(out state) ? "Congratulations, \"{1} {2}\", you do not appear to be a bot. (Details: {0})" : "Rejected; user appears to be a bot. (Details: {0})"), state.ToString(), TextBox1.Text, TextBox2.Text); StringBuilder sb = new StringBuilder(); foreach (KeyValuePair <DateTime, string> kvp in NoBot.GetCopyOfUserAddressCache()) { sb.AppendFormat("{0}: {1}<br />", kvp.Key.ToString("u"), kvp.Value); } Label2.Text = sb.ToString(); } else { // Display input view MultiView1.SetActiveView(View1); } }
protected void btnSend_Click(object sender, EventArgs e) { NoBotState state; // if condition to check the response state of NoBot if (NoBot1.IsValid(out state)) { Label2.Text = state.ToString(); } else { Label2.Text = state.ToString(); } StringBuilder sb = new StringBuilder(); // foreach loop to get cached IP address and datetime assocated with it(when last postback was occurred) foreach (System.Collections.Generic.KeyValuePair <DateTime, string> keyValue in NoBot.GetCopyOfUserAddressCache()) { sb.AppendFormat("{0}: {1}<br />", keyValue.Key.ToString(), keyValue.Value); } Label4.Text = sb.ToString(); }