using asp.net mvc 4,
I created a class with a static method like this
public class StaticClass
{
public static int val { get; set; }
public static string ReturnValueBasedOnInput(int n)
{
string res;
switch (n)
{
case 101:
Thread.Sleep(30000);
res = "Long lasting response: 101" + val;
break;
default:
res = n.ToString() + " was provided..." + val;
break;
}
return res;
}
}
it is called from my controller :
public ActionResult Index(int id = 1)
{
ViewBag.returnValue = StaticClass.ReturnValueBasedOnInput(id);
return View(id);
}
I expected that when i call the method with a parameter value of 101 the application should be blocked for 30 secs, but it remains responsive. I thought since this is a static method it should be blocked for 30 second for all incoming method calls. can someone explain what happens here?
Long lasting response: 101?