aspnetcore/breaking-changes/5/iis-urlrewrite-middleware-query-strings-are-preserved.md
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.
ASP.NET Core 5.0
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.
The query string is preserved. The URI from the example in Old behavior would be /contact?id=1.
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.
If the behavior of removing the query string is preferred, set the action element to appendQueryString="false".