【发布时间】:2023-04-06 01:12:01
【问题描述】:
我正在创建一个 asp.net Web 应用程序,我希望它可以在 url 中使用或不使用文件扩展名
举个例子让我们说这是我们的网址
localhost:8080/Login.aspx?something=1
我希望它在用户输入时工作
localhost:8080/Login?something=1
或
localhost:8080/Login.aspx?something=1
我做了这样的事情
<rewrite>
<rules>
<rule name="Rewrite with .aspx" stopProcessing="true">
<match url="^(.+)(\?(.+)$|\#(.+)$|$)"/>
<action type="Rewrite" url="{R:1}.aspx{R:2}"/>
</rule>
</rules>
</rewrite>
有时这可行,但根本不行。它会影响页面中除地址栏中的 url 之外的所有其他 url 吗?我的网站中有 iframe。请帮助我。
谢谢
【问题讨论】:
标签: c# asp.net url web-config rewrite