zoukankan      html  css  js  c++  java
  • asp.net C# 将网页转换为.html 格式

    asp.net C# 将网页转换为.html 格式
    asp.net C# 将网页转换为.html 格式(比如 www.baidu.com/index.html)而不是 www.baidu.com/index.aspx 这页面要求 用户能和数据库 进行数据交互!

    ------解决方案--------------------------------------------------------
    可以用URL重新的方式,也可以生成静态页。

    URL重写演示

    这个就是URL重写后的效果

    ------解决方案--------------------------------------------------------
    伪静态
    参考
    伪静态实现

    URL重写都可以实现

    一分钟URL重写
    ------解决方案--------------------------------------------------------
    http://blog.csdn.net/shixin1198/archive/2006/10/16/1336846.aspx
    ------解决方案--------------------------------------------------------
    URL重写
    ------解决方案--------------------------------------------------------
    urlrewrite
    ------解决方案--------------------------------------------------------
    <RewriterConfig>
    <Rules>
    <RewriterRule><LookFor>~/(\d+)\.html</LookFor><SendTo>~/Content.aspx?id=$1</SendTo></RewriterRule>
    </Rules>
    </RewriterConfig>

    webconfig里这么写,参考下语法
    ------解决方案--------------------------------------------------------
    2个思路 一种是 URL重写~ 一种是页面静态化~ 第一种重写可以利用urlrewrite 第二种 用IO~
    ------解决方案--------------------------------------------------------
    url重写
    ------解决方案--------------------------------------------------------
    web.config文件 <configSections> 节点中加入
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />


    重写规则
    <RewriterConfig>
    <Rules>
    <RewriterRule>
    <LookFor>~/index.html</LookFor>
    <SendTo>~/index.aspx</SendTo>
    </RewriterRule>
    </Rules>
    </RewriterConfig>

    <httpHandlers>节点
    <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />

     <httpModules>节点
    <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />

    最后在iis中映射下 .html文件指向.net框架
    ------解决方案--------------------------------------------------------

    http://msdn.microsoft.com/zh-cn/library/ms972974.aspx

       
    看看MSDN的

  • 相关阅读:
    分页存储过程
    C#,单元测试
    telerik reporting报表
    在Linq to sql 和 Entity framework 中使用lambda表达式实现left join
    .NET提供了三种后台输出js的方式:
    转换人民币大小金额
    ASP.Net Post方式获取数据流的一种简单写法
    js数组中两个有相同删除一个
    我的个人博客
    It is the courage
  • 原文地址:https://www.cnblogs.com/qqxiongmao/p/3044465.html
Copyright © 2011-2022 走看看