I am not an MVC expert, but I am sure it is possible; however, I do not know how to do this in MVC 4.
For testing, I use the default web application specified when creating the site using VS 2012.
For simplicity, let us consider that HomeController.Index () gets exactly at the same time by several users (for example, 3). I want to execute a method that is mutexed, since only one will execute at a time; hence forcing them in series. I don't care what order. I know the warnings about page locking and that everything should be asynchronous, but for this I need to block for a very short period of time.
public class HomeController : Controller { private String dosomething() { String str; str = "SomeValue";
source share