Threading lock not working in ASP.NET WebForms

Hi All,

Very recently i have come across a very strange problem (at least for me) which seems to be very common but i do not have any answer for it.I have a Asp.Net web forms application where i am using threading to block execution of a piece of code by multiple threads which however is not working.

private static object _myLock = new object();

#region myMethod
private void myMethod()

lock (_myLock)
pnlMarkingSession.Visible = false;
pnlMarking.Visible = true;
txtExaminerComment.Text = "";
DataTable dataTable = DAL.GetITEMSTop5(CurrentMarkingSession, UserHelper.CurrentUser.UserId);
grdPrevious.DataSource = dataTable;

I believe lock() is mostly used for windows applications where the thread lock prevents multiple threads from accessing the code in the same system. However i am not sure how this will work in case of web applications which is hosted on multiple servers through a load balancer. Will thread lock work in case two requests are served by different servers. What is the correct way to implement thread lock in web applications?