Asp.net 如何在MVC5中从类文件重定向到登录页面

Asp.net 如何在MVC5中从类文件重定向到登录页面,asp.net,asp.net-mvc,asp.net-mvc-5,Asp.net,Asp.net Mvc,Asp.net Mvc 5,如果发生错误,我想重定向到特定页面或登录页面 HttpContext context = HttpContext.Current; string redirectString = ""; context.Session["RoleID"] = null; context.Session["Username"] = null; context.Session["SuperAdmin"] = null; con

如果发生错误,我想重定向到特定页面或登录页面

HttpContext context = HttpContext.Current;
string redirectString = "";
    
context.Session["RoleID"] = null;
context.Session["Username"] = null;
context.Session["SuperAdmin"] = null;
context.Session.Abandon();
context.Session.RemoveAll();
redirectString = "Login/Login";--Here both controller and view name is Login
redirectString = "~/Views/Login/Login.cshtml"; --I try this but not working for me
context.Response.Redirect(redirectString, true);
那么,我如何重定向到显示一些错误消息的登录页面

这是我的视图文件夹结构。

请确保您的登录控制器名称为LoginController