我试着把*.aspx?id=12重定向为12.html,却不行!但是把它写成12.aspx却可以这里求教大家,谢谢!(我vs05运行时可以,但是配置到虚拟目录时却不能浏览了!)

解决方案 »

  1.   

    配置文件:
    <configuration>
    <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
    </configSections>
    <connectionStrings>
      <add name="xiaocaiConnectionString" connectionString="Data Source=.;Initial Catalog=xiaocai;Persist Security Info=True;User ID=sa;Password=xiaocai"
       providerName="System.Data.SqlClient" />
     </connectionStrings>
     <RewriterConfig>
    <Rules>
    <RewriterRule>
    <LookFor>~/articles/(\d+)\.aspx</LookFor>
    <SendTo>~/show.aspx?D_id=$1</SendTo>
       </Rules>
    </RewriterConfig>
    <system.web>
    <httpHandlers>
    <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter"/>

    </httpHandlers>
    ----------------
     这是链接:
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "../articles/"+Convert.ToString(Eval("D_id"))+".aspx" %>' 
                                Text='<%# "<li>"+Eval("Title") %>'></asp:HyperLink>
      

  2.   

    因为html默认是不传到asp.net引擎的
    只需修改一下就行 将html用asp.net引擎就行
    aspx默认就是 所以会出现你说的问题