玉祥平台客服-15087858732

标题: C# MVC中挂接HTML页面 [打印本页]

作者: Adam丶鱼    时间: 2020-6-21 19:08
标题: C# MVC中挂接HTML页面
需求:word另存为html  getResult.html,挂接在c# .net mvc 框架 中,点击超链接在系统中展现html页面
方法:
1、在Web.config 中添加如下代码
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".htm" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
2、然后在controller中编写方法跳转到相应的aspx页面
public ActionResult GetResult(){
  return View();
}
3、在getResult.aspx页面编写如下代码:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<div>
<%Html.RenderPartial("~/Views/Home/GetResult.htm");%>
</div>
</body>
</html>


作者: Adam丶鱼    时间: 2020-6-21 19:09

作者: Adam丶鱼    时间: 2020-6-21 19:10

作者: fteair    时间: 2020-6-24 14:28

作者: 张兴康    时间: 2020-6-24 17:21





欢迎光临 玉祥平台客服-15087858732 (http://bbs.delit.cn/) Powered by Discuz! X3.2