[已解决问题] how to create static html page
提问时间: 2008-06-27 13:37
悬赏分:10 浏览:186 次
I am build a dynamic website use asp.net, and i am want chang it to a static website as look like. Forexample, user can browser 34.html as same as somefile.aspx?ID=34.
similar following:

http://www.handandaily.com/ShowFAQ.aspx?ID=514

http://www.handandaily.com/514.html
How can I do it?
提问者:kaixin110 - 初学一级

问题补充:我使用的是虚拟主机呀!,我的是VS2003 ,C#,ASP.NET我原本想通过getResponse这样方法保存html内容为html内容为html文件,但是这种也不是太理想!
我如果执行一个请求一个html文件怎么在Global.asax里面请求控制,

所有回答(3)
url重定向.
可以使用UrlRewrite组件,像博客园的那种.
http://www.cnblogs.com/JeffreyZhao/archive/2008/01/12/url-rewrite-1.html
1个月前   回答者:侯垒 - 小虾三级
1.ASP.NET页面静态化,即根据模板在保存时直接生成HTML,网上有很多这样的资料。

2.使用URL重写,参考楼上给出的链接地址,或者看看ScottGu给出的方案:
http://blog.joycode.com/scottgu/archive/2007/03/01/94004.aspx
1个月前   回答者:TerryLee - 小虾三级
需要在iis里设置,把*.html交给asp.net处理.然后把你所有的aspx文件改名成html文件.
通常,虚拟主机无法完成第一步的.你可以与服务商沟通一下,祝你好运.
1个月前   回答者:deerchao - 大侠五级
评论
1个月前   kaixin110 :
  void Application_BeginRequest(object sender, EventArgs e) {

        string fullOrigionalpath = Request.Url.ToString();
        
        if (fullOrigionalpath.Contains("/Products/Books.aspx")) {
            Context.RewritePath("/Products.aspx?Category=Books");
        }
        else if (fullOrigionalpath.Contains("/Products/DVDs.aspx")) {
            Context.RewritePath("/Products.aspx?Category=DVDs");
        }
    } 

这个方法

如果是一个html文件能执行到这里吗?
我要的效果是这样的
       if (fullOrigionalpath.Contains("/100.html")) {
            Context.RewritePath("/Products.aspx?Category=100");

不知道HTML文件能不能执行这个
Application_BeginRequest
1个月前   kaixin110 :
now getresponsestream 
save html file
!


   您需要登录以后才能回答!
我的问题    我要提问


快到期问题

> 问题排行榜

有不合适内容,建议去除