源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

把aspx页面伪装成静态html格式的实现代码

  • 时间:2020-09-28 11:03 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:把aspx页面伪装成静态html格式的实现代码
在 Global.asax 中添加 Application_BeginRequest 事件:
[u]复制代码[/u] 代码如下:
protected void Application_BeginRequest(object sender, EventArgs e) { string pathAndQuery = Request.Url.PathAndQuery.ToLower(); if (pathAndQuery.IndexOf(".html") > -1) { pathAndQuery = "~/" + pathAndQuery.Replace(".html", ".aspx"); HttpContext.Current.RewritePath(pathAndQuery); } }
这样就可以用xxx.html 来访问你的 xxx.aspx页面了,浏览器地址栏显示的是xxx.html(页面带参数也是可以的)。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部