一.配置文件web.config添加一下设置

<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

二.RouteConfig.cs设置

            routes.MapRoute(
"Login",
"Login.html",
new { controller = "Home", action = "Login" }
); routes.MapRoute(
"Index",
"index.html",
new { controller = "Home", action = "Index" }
); routes.MapRoute(
"Default",
"{controller}/{action}.html",
new { controller = "Home", action = "Index"}
);

三.上面设置好后基本上已经完成了,但是运行时发现首页不对,这个时候需要一下设置

在Global.asax文件里设置首页

        //把首页设置为重定向后的index.html地址
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Context.Request.FilePath == "/") Context.RewritePath("index.html");
}

最新文章

  1. 整理: Android HAL
  2. 跟我一起学WCF(5)——深入解析服务契约[上篇]
  3. Careercup - Google面试题 - 6332750214725632
  4. 【Valid Parentheses】cpp
  5. ubuntu下Rhythmbox播放器乱码问题解决方案
  6. 解决ashx文件下的Session“未将对象引用设置到对象的实例”
  7. 零基础学Python 3之环境准备
  8. Eclipse的修改编码插件使用
  9. sourceTree安装与使用
  10. iostat中 %util高 应用延迟高
  11. css reset的重置作用(可取还是不可取,取决于你)
  12. 《jmeter:菜鸟入门到进阶》系列
  13. Django 之 cookie和session
  14. 1.编写一个shell脚本
  15. 面向对象【林老师版】:__init__定制自己独有的特征(三)
  16. 【Java】-NO.16.EBook.4.Java.1.003-【疯狂Java讲义第3版 李刚】- oop
  17. 四则运算level2
  18. 【Centos】centos查看磁盘使用情况
  19. vulcanjs 包类型
  20. RAC转换传统的通信

热门文章

  1. CSAcademy Palindromic Concatenation 字符串哈希
  2. 《Cracking the Coding Interview》——第16章:线程与锁——题目3
  3. USACO Section1.2 Transformations 解题报告
  4. Oracle 学习----:Oracle删除表时报错:表或视图不存在
  5. 孤荷凌寒自学python第三十八天初识python的线程控制
  6. python中的re模块,常用函数介绍
  7. GCC特性之__init修饰解析 - kasalyn的专栏 - 博客频道 - CSDN.NET
  8. Java性能监控之Java程序执行解析
  9. FreeBSD NTP 简单使用
  10. AtCoder keyence2019 E Connecting Cities