.net framework 2.0伪静态配置

web.config文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections>
	<!-- appSettings网站信息配置-->
	<appSettings>
		<add key="Configpath" value="~/XmlConfig/webset.config" />
    <add key="DbPath" value="~/Data/666.mdb" />
	</appSettings>
	<!-- 数据库连接字符串-->
	<connectionStrings>
		<add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
  </connectionStrings>


  <RewriterConfig configSource="rewrite.xml"/>


  <system.web>
		<!-- 
            设置 compilation debug="true" 可将调试符号插入
            已编译的页面中。但由于这会
            影响性能,因此只在开发过程中将此值 
            设置为 true。
        -->
		<compilation debug="true">
    <buildProviders>
      <add extension=".aspx" type="System.Web.Compilation.PageBuildProvider" />
      <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
    </buildProviders>
  </compilation>
		<!--
            通过 <authentication> 节可以配置 ASP.NET 用来 
            识别进入用户的
            安全身份验证模式。 
        -->
		<authentication mode="Windows" />
      <customErrors mode="Off" />
		<!--
            如果在执行请求的过程中出现未处理的错误,
            则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
            开发人员通过该节可以配置
            要显示的 html 错误页
            以代替错误堆栈跟踪。
       

        <customErrors mode="RemoteOnly" defaultRedirect="FileNotFound.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>-->
      <httpRuntime maxRequestLength="20480" executionTimeout="600" />
    <httpHandlers>
        <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
        <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />

    </httpHandlers>

  </system.web>
    <system.webServer>
        <directoryBrowse enabled="true" />
         
    </system.webServer>
</configuration>

rewrite.xml文件

<?xml version="1.0" encoding="utf-8"?>
<!-- 注意: 除了手动编辑此文件以外,您还可以使用 Web 管理工具来 
     配置应用程序的设置。可以使用 Visual Studio 中的“网站”->“ASP.NET 配置”
     选项。
     设置和注释的完整列表在
     machine.config.comments 中,该文件通常位于 \Windows\Microsoft.NET\Framework\v2.0.xxxxx\Config 中
 -->
<RewriterConfig>
  <Rules>
    <RewriterRule>
      <LookFor>~/index\.html</LookFor>
      <SendTo>~/index.aspx</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/about\.html</LookFor>
      <SendTo>~/profile/index.aspx</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/contact\.html</LookFor>
      <SendTo>~/profile/index.aspx?id=66</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/news\.html</LookFor>
      <SendTo>~/news/index.aspx</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/products\.html</LookFor>
      <SendTo>~/products/index.aspx</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/news/index-(.[0-9]*)\.html</LookFor>
      <SendTo>~/News/index.aspx?id=$1</SendTo>
    </RewriterRule>
    <RewriterRule>
      <LookFor>~/products/index-(.[0-9]*)\.html</LookFor>
      <SendTo>~/products/index.aspx?id=$1</SendTo>
    </RewriterRule>
      <RewriterRule>
          <LookFor>~/products/index\.html</LookFor>
          <SendTo>~/products/index.aspx?id=188</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/news/detail-(.[0-9]*)\.html</LookFor>
          <SendTo>~/News/detail.aspx?id=$1</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/products/detail-(.[0-9]*)\.html</LookFor>
          <SendTo>~/products/detail.aspx?id=$1</SendTo>
      </RewriterRule>

      <RewriterRule>
          <LookFor>~/m/index\.html</LookFor>
          <SendTo>~/m/index.aspx</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/about\.html</LookFor>
          <SendTo>~/m/about.aspx</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/contact\.html</LookFor>
          <SendTo>~/m/about.aspx?id=66</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/nlist\.html</LookFor>
          <SendTo>~/m/nlist.aspx</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/plist\.html</LookFor>
          <SendTo>~/m/plist.aspx</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/nlist-(.[0-9]*)\.html</LookFor>
          <SendTo>~/m/nlist.aspx?id=$1</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/plist-(.[0-9]*)\.html</LookFor>
          <SendTo>~/m/plist.aspx?id=$1</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/ndetail-(.[0-9]*)\.html</LookFor>
          <SendTo>~/m/Ndetail.aspx?id=$1</SendTo>
      </RewriterRule>
      <RewriterRule>
          <LookFor>~/m/pdetail-(.[0-9]*)\.html</LookFor>
          <SendTo>~/m/pdetail.aspx?id=$1</SendTo>
      </RewriterRule>
  </Rules>
</RewriterConfig>

IIS映射配置

第一、选定该站点,进入管理面板,打开【处理程序映射】


第二、点击【添加脚本映射】


第三:配置映射脚本


可执行文件:C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

注意:你的.net framework 2.0在哪里目录下就选择那个,但是最终必须选择文件【aspnet_isapi.dll】这个很重要


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

橙-极纪元JJY.Cheng

客官,1分钱也是爱,给个赏钱吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值