排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术

MVC 页面跳转
前 言
tnblog
M V C 是通过控制器来访问页面的
本视图内跳转
public ActionResult News() { //打开本视图,名称为News.cshtml return View(); } public ActionResult News2() { //跳转到本视图Index.cshtml (浏览器地址会发生变化) return RedirectToAction("Index"); } public ActionResult News3() { //跳转到本视图ActionResult Index() (浏览器地址不会发生变化) return View("Index"); }
本视图外跳转
public ActionResult News2() { //跳转到视图Game文件夹 的 Index.cshtml (浏览器地址会发生变化) return RedirectToAction("Index","Game"); } public ActionResult Game() { //跳转到视图/Game文件夹/Index.cshtml (浏览器地址不会发生变化) return View("~/Views/Game/Index.cshtml"); }
评价