手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >把aspx页面伪装成静态html格式的实现代码
把aspx页面伪装成静态html格式的实现代码
摘要:在Global.asax中添加Application_BeginRequest事件:复制代码代码如下:protectedvoidApplic...

在 Global.asax 中添加 Application_BeginRequest 事件:

复制代码 代码如下:

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(页面带参数也是可以的)。

【把aspx页面伪装成静态html格式的实现代码】相关文章:

asp.net 生成静态时的过滤viewstate的实现方法

asp.net用三层实现多条件检索示例

asp.net 文件下载实现代码

asp.net传多个值到其它页面的具体实现

Asp.NET 多层登陆实现代码

asp.net(C#) 生成随机验证码的代码

asp.net Execl的添加,更新操作实现代码

动态ItemTemplate的实现(译) - item,template

ASP.NET抓取网页内容的实现方法

asp.net高效替换大容量字符实现代码

精品推荐
分类导航