• iis6|iis7|配置URLRewriter|64位操作系统下|.net2.0|.net4.0|配置URLRewriter|Web.config配置详情


    想必很多ASP.NET的码友们在IIS配置伪静态被严重纠结过不止一次两次,本园主经过多次站点伪静态配置,总结了一下,IIS版本:IIS 6、IIS 7,服务器:Windows Server 2003、Windows Server 2008,开发机多半是Windows 7,站点.NET Framework 2.0、.NET Framework 4.0 ,随机搭配任意组合,时行时不行,完全靠运气以及人品,被虐千百遍之后,真是刻苦铭心闻者伤心见者也会流泪...

    简单粗暴点吧,我认为直接帖上Web.config文件最实在

    <?xml version="1.0"?>
    <configuration>
      <configSections>
        <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
      </configSections>
      <RewriterConfig>
        <Rules>
          <RewriterRule>
            <LookFor>~/(w*).html</LookFor>
            <SendTo>~/Default.aspx?id=$1</SendTo>
          </RewriterRule>
          <RewriterRule>
            <LookFor>~/news-(w*)_(w*).html</LookFor>
            <SendTo>~/Default.aspx?id=$1&amp;tt=$2</SendTo>
          </RewriterRule>
        </Rules>
      </RewriterConfig>
      <system.web>
        <!--<compilation debug="true" targetFramework="2.0" />-->
        <httpHandlers>
          <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>
          <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>
        </httpHandlers>
      </system.web>
      <system.webServer>
        <handlers>
    
            <!--.NET Framework 2.0 或 .NET Framework 4.0 二选一 -->
            <!--.NET Framework 2.0 用这-->
            <add name="woool1" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFrameworkv2.0.50727aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
            <add name="woool" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFrameworkv2.0.50727aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32"/>
            <!--64位操作系统就加上 ? -->
            <add name="woool1_64" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFramework64v2.0.50727aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
            <add name="woool_64" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFramework64v2.0.50727aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32"/>
            <!--.NET Framework 2.0 用这结束-->
            
            <!--.NET Framework 4.0 用这开始-->
            <add name="woool1" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
            <add name="woool" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32"/>
            <!--64位操作系统就加上 ? -->
            <add name="woool1_64" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFramework64v4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
            <add name="woool_64" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="C:WindowsMicrosoft.NETFramework64v4.0.30319aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32"/>
            <!--.NET Framework 4.0 用这结束-->
            
        </handlers>
        <!--iis 7.0 下支持 URLRewriter ? -->
        <modules>
          <add name="ModuleRewriter" type="URLRewriter.ModuleRewriter, URLRewriter"/>
        </modules>
      </system.webServer>
    </configuration>

    下载例子URLRewriter.dll

  • 相关阅读:
    2014 12 27 bestcoder 第一题
    大数阶乘问题!
    学校acm比赛题
    hdu1002 大数相加问题
    写于创建之初
    Linux指令 vi编辑,保存及退出
    Java基础-反射
    Java基础-接口与多态
    00023-layui表单有check、radio、switch,未选中时值不提交的解决
    00022-layui 显示表单,iframe父子页面传值
  • 原文地址:https://www.cnblogs.com/yonsy/p/5072529.html
Copyright © 2020-2023  润新知