重定向后停止 cshtml View 呈现的正确方法是什么?
我可以在 cshtml 里面返回吗?
@{
if (someCondition) {
Response.Redirect("/login");
return;
}
}
}
<!DOCTYPE html>
....
最佳答案
我相信这可能是一个重复的问题,简短的回答是:
对 return;
完全有效从 cshtml 中;但是通常有更好的方法。
资料来源:
关于asp.net-mvc - 如何在 cshtml 中停止 ASP.NET MVC View 渲染?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31033318/