MSDNURLRewriting重写动态传参数的问题
<a href="<%=ResolveUrl("C/378.html")%>" 关于我们</a> (实际访问的是Content.aspx?id=378)这里的378是一个参数,如果动态绑定应该怎么绑定啊。。。试了很多次都不对。。
配置文件:
MSDNURLRewriting --------------------编程问答-------------------- 光配置了文件是米用的
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<!--伪静态配置-->
<RewriterRule>
<LookFor>~/content/(\d{1,6})/(\d{1,6})\.html?</LookFor>
<SendTo>~/Content.aspx?id=$1&CatalogID=$2</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/content/(\d{1,6})\.html?</LookFor>
<SendTo>~/Content.aspx?id=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/index\.html?</LookFor>
<SendTo>~/index.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/about\.html?</LookFor>
<SendTo>~/about.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/news\.html?</LookFor>
<SendTo>~/news.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/product\.html?</LookFor>
<SendTo>~/product.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/prozs\.html?</LookFor>
<SendTo>~/prozs.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/cgal\.html?</LookFor>
<SendTo>~/cgal.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/zxly\.html?</LookFor>
<SendTo>~/zxly.aspx</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<appSettings>
<!-- 连接字符串是否加密 -->
<add key="ConStringEncrypt" value="false"/>
<!-- 数据库连接字符串,(如果采用加密方式,上面一项要设置为true;加密工具,可在官方下载,
如果使用明文这样server=127.0.0.1;database=.....,上面则设置为false。 -->
<add key="ConnectionString" value="server=.;database=cq;uid=;pwd="/>
<!--其它模块连接字符串,可以不断增加以便同一个项目支持连接多个数据库。如果没有,可以删除该行-->
<add key="ConnectionString2" value="server=127.0.0.1;database=codematic2;uid=sa;pwd=1"/>
</appSettings>
<system.web>
<httpHandlers>
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
<httpRuntime executionTimeout="3600" maxRequestLength="1048576"/>
<compilation debug="true" />
<customErrors mode="Off" />
<identity impersonate="true"/>
<authentication mode="Forms">
<forms name="forums" path="/" loginUrl="Login.aspx" protection="All" timeout="40">
</forms>
</authentication>
</system.web>
</configuration>
楼主可以看看介个
补充:.NET技术 , ASP.NET