Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An IIS UrlRewrite middleware defect prevented the query string from being preserved in rewrite rules. That defect has been fixed to maintain consistency with the IIS UrlRewrite Module's behavior.
For discussion, see issue dotnet/aspnetcore#22972.
Version introduced
ASP.NET Core 5.0
Old behavior
Consider the following rewrite rule:
<rule name="MyRule" stopProcessing="true">
<match url="^about" />
<action type="Redirect" url="/contact" redirectType="Temporary" appendQueryString="true" />
</rule>
The preceding rule doesn't append the query string. A URI like /about?id=1
redirects to /contact
instead of /contact?id=1
. The appendQueryString
attribute defaults to true
as well.
New behavior
The query string is preserved. The URI from the example in Old behavior would be /contact?id=1
.
Reason for change
The old behavior didn't match the IIS UrlRewrite Module's behavior. To support porting between the middleware and module, the goal is to maintain consistent behaviors.
Recommended action
If the behavior of removing the query string is preferred, set the action
element to appendQueryString="false"
.