MVC中加载aspx

1.新建aspx文件

2.在控制器中访问aspx页面

    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            DbContextBase db = new DbContextBase();
            var list=db.ServiceCategoryNavTBs.ToList();
            return View();
        }
        public ActionResult Report()
        {
            string aspx = "/AspNets/RdlcView.aspx";
            using(var sw=new StringWriter())
            {
                System.Web.HttpContext.Current.Server.Execute(aspx, sw, true);
                return Content(sw.ToString());
            }
        }
    }
View Code

 

posted @ 2017-12-01 01:55  连先森  阅读(1527)  评论(1编辑  收藏  举报