手机
当前位置:查字典教程网 >编程开发 >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格式的实现代码】相关文章:

.Net连接Oracle数据库的实现代码

asp.net 生成曲线图实现代码

Asp.Net类库中发送电子邮件的代码

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

asp.net Xml绑定到数据控件的具体实现

页面包含的处理

asp图片防盗链的代码

c# .net 生成图片验证码的代码

asp.net中调用winrar实现压缩解压缩的代码

asp用户登录模块实例代码

精品推荐
分类导航