重写ASP.NETWeb表单中的URL
我刚刚从ASP.NETMVC应用程序后退一步,转到ASP.NETWeb表单,我想知道是否也可以在Web表单中重写url。我有以下一组URL需要重新写入:重写ASP.NETWeb表单中的URL,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,我刚刚从ASP.NETMVC应用程序后退一步,转到ASP.NETWeb表单,我想知道是否也可以在Web表单中重写url。我有以下一组URL需要重新写入: Edit.aspx?type=grbat Edit.aspx?type=lrbat Edit.aspx?type=glsi Edit.aspx?type=llsi 如您所见,所有内容都在一个页面上工作 但是,我想让URL更加用户友好,并将其替换为: EditGlobalTopic.aspx EditLocalTopic.aspx Edit
- Edit.aspx?type=grbat
- Edit.aspx?type=lrbat
- Edit.aspx?type=glsi
- Edit.aspx?type=llsi
- EditGlobalTopic.aspx
- EditLocalTopic.aspx
- EditGlobalInitiative.aspx
- EditLocaliative.aspx
谢谢我想你需要在这里重新编写url(isapi或其他类似工具)来实现你想要的 在这里,您正在访问4个不同的页面,需要创建它们,否则服务器将以404响应
您可以创建这4个页面,然后使用适当的参数重定向到edit.aspx,但我仍然认为使用url重写是一种更好的方法(因为这是它的目的)我认为您需要在此处重写url(isapi或其他类似工具)以实现您的目标 在这里,您正在访问4个不同的页面,需要创建它们,否则服务器将以404响应
您可以创建这4个页面,然后使用适当的参数重定向到edit.aspx,但我仍然认为使用url重写是更好的方法(因为这是它的目的)您可以使用开源组件:
我过去使用过这个,能够快速创建友好的URL。您可以使用开源组件:
我过去使用过这个,能够快速创建友好的URL。您好,您可以使用下面的方法从Web.config轻松重写URL,
<system.webServer>
<rewrite>
<rules>
<rule name="default">
<match url="^EditGlobalTopic.aspx" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="\.axd" negate="true" />
</conditions>
<action type="Rewrite" url="Edit.aspx?type=grbat" />
</rule>
</rules>
</rewrite>
</system.webServer>
它将在该页面上重定向您。您好,您可以使用下面的方法从Web.config轻松重写URL,
<system.webServer>
<rewrite>
<rules>
<rule name="default">
<match url="^EditGlobalTopic.aspx" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="\.axd" negate="true" />
</conditions>
<action type="Rewrite" url="Edit.aspx?type=grbat" />
</rule>
</rules>
</rewrite>
</system.webServer>
它将在该页面上重定向您。您以前看过这个吗:?您以前看过这个吗??