【发布时间】:2021-07-30 06:07:03
【问题描述】:
问候,请原谅我可能不重要的问题,我只是想重新装饰我在 Asp.net Web Forms 应用程序中使用的 URL,就像使用 razor 的 Asp.net MVC 应用程序一样,这是我完成的第一步是删除 aspx 继任者,我已经完成了这个,但我正在尝试的第二步是将 pagename?id=someid 替换为 pagename/id 或除常用公式外的任何公式,最终任务是减少 ULR 中使用的字符,因此删除 .aspx 将排除 4 个字符,第二种方法将替换 ?id= 与斜杠 并且像 n1 这样使用 pagename+id 重命名页面不会访问服务器,因为页面名称会被更改 欢迎任何建议! 我在 web.config 上进行了以下更改以排除 aspx 继任者
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteASPX">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
</rules>
</rewrite>
</system.webServer>
【问题讨论】:
标签: asp.net web concept web-technologies