处理控制器类的动作BeginExecute时如何进行RedirectToAction

时间:2018-09-21 03:19:03

标签: asp.net-mvc-5

我处理控制器的BeginExecute方法,并且我想在此函数中使用RedirectToAction。但是返回的Type不兼容。我该怎么办?这是我的代码:

protected override IAsyncResult BeginExecute(RequestContext requestContext, AsyncCallback callback, object state)
    {          

        byte[] ssVersionNo = (byte[])System.Web.HttpContext.Current.Session["VersionNo"];
        string userName = System.Web.HttpContext.Current.Session["UserName"].ToString();
        Employee emp = _employee.GetByUserName(userName);
        if (!emp.VersionNo.SequenceEqual(ssVersionNo))
        {
            //I want to throw away in this? how?
            return RedirectToAction("LogOff", "Authen");
        }

        return base.BeginExecute(requestContext, callback, state);
    }

0 个答案:

没有答案