【发布时间】:2019-03-05 03:35:29
【问题描述】:
我将 URL 创建为 - http://localhost:13490/level1/XYZ/hulhbgma79
试图重定向这个网址 - http://localhost:13490/level1/PQR/HttpHandler.ashx?Id=hulhbgma79
在上面给出的 URL 示例中
- level1 - 此名称根据条件、level2 或 level3 变化。
- XYZ - 是虚拟模块。
- PQR 是存放 HttpHandler.ashx 的文件夹。
- Id 是可验证的查询字符串参数。
- hulhbgma79 是为查询字符串参数传递的值。
我已经为这种情况写了如下规则 -
<rule name="RewriteURL" stopProcessing="true">
<match url="^XYZ\/((([A-Za-z0-9]+)(\s|&)([^\/]+))|(([^\/]+)(\s|&))|([^\/]+))\/?$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/PQR/HttpHandler.ashx?Id={R:9}" />
</rule>
没有按预期工作。
任何人都可以帮助我获得相同的解决方案吗?
【问题讨论】:
标签: c# url-rewriting web-config