我在特定的时间,在一个特定的时间扭动一个简单的在线游戏, ,游戏将被更新,当时间到了,首先我需要注销用户。 在Global.asax的“Application_Start”函数中,我初始化了计时器,当它打勾时,调用我在Global.asax中写的方法“UpdateGame”。这里是方法:在Global.asax注销用户
public static void UpdateGame()
{
AccountController account = new AccountController();
AdminController admin = new AdminController();
HomeController home = new HomeController();
account.LogOff();
admin.ChechHireEndTimes();
admin.CheckRentsEndTimes();
admin.UpdateRankings();
admin.InitializeAbstractTimes();
}
当它来到logOff(),它冻结。这里是注销方法:
[Authorize]
public ActionResult LogOff()
{
FormsService.SignOut();
return RedirectToAction("Index", "Home");
}
我工作了很多,但它似乎是因为注销不与HTTP请求调用时,它不工作当用户按下注销按钮。
所以我的问题是,我如何从Global.asax内部调用像这样的控制器的动作?
This [answer](http://stackoverflow.com/a/2355104/60108)可能会帮助你。 – Eranga 2011-12-29 10:01:25
是的,谢谢Eranga,这是我的回答。 – nafiseh 2011-12-29 10:26:27