我想从basecontroller的OnActionExecuting方法进行重定向,但是它显示了我网站的空白页面,并且重定向不起作用
这是我的代码片段
公共重写void OnActionExecuting(ActionExecutingContext上下文) {
ContextHelper.SetContextHelper(HttpContext.Request.Scheme,
HttpContext.Request.Host.ToString(), HttpContext.Request.Path);
string url = HttpContext.Request.Host.ToString();
string path = HttpContext.Request.Path.ToString();
if (HttpContext.Session != null)
{
AdminSessionHelper.session = HttpContext.Session;
SessionHelper.deliverysession = HttpContext.Session;
}
url = url + "abc";
context.Result = new RedirectResult(url);
base.OnActionExecuting(context);
这里的URL给了我当前的URL,写的“ abc”是我要重定向的区域。