我有以下代码,但它会显示错误消息:
var url = (string) Session["CurrentUrl"];
if (url != null)
{
var ip = new Uri(url);
var ipNoPort = string.Format("{0}://{1}/{2}", ip.Scheme, ip.Host, ip.PathAndQuery);
return RedirectResult(ipNoPort);
}
return View();
错误指向RedirectResult,说错误1'System.Web.Mvc.RedirectResult'是'type',但用作'变量'
答案 0 :(得分:3)
return new RedirectResult(ipNoPort);
我认为你把它与
混淆了return RedirectToRoute("Home");
哪个是控制器的成员。