【发布时间】:2012-03-18 17:47:35
【问题描述】:
如何使用以下代码调用帐户
http://www.domain.ext/madcoder
而不是
http://www.domain.ext/index.aspx?key=madcoder
因为我的madcoder 是我获取数据库的主要搜索键
我找到了以下代码,但不明白如何使用它。请任何人帮助我。
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="?p={R:1}" />
</rule>
编辑 1
我尝试以下面的方式修改我的 web.config 文件,这给了我错误
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.aspx?key={R:1}" />
</rule>
</configuration>
【问题讨论】: