2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11
12 public partial class Default2 : System.Web.UI.Page
13 {
14
15 public static Object synchronizeVariable = “locking”;
16
17 protected void Page_Load(object sender, EventArgs e)
18 {
19 String fileName = Context.Server.MapPath(“~”) +
20 “\\App_Data\\UserAgents.txt”;
21 lock (synchronizeVariable)
22 {
23 StreamWriter sw = new StreamWriter(fileName, true);
24 sw.WriteLine(DateTime.Now);
25 sw.WriteLine(Request.UserAgent);
26 sw.Close();
27 }
28 }
29 }