Category Archives:

Rewrite rule from Web Forms request with Query String to MVC Action

I am trying to rewrite this Web Forms request

to this MVC Action

The action signature is

public IActionResult Index(string version, string computerName, string RegistrationId, int CALs, string message = null)

My rewrite rule is in wwwroot/web.config/<system.webServer><rewrite><rules> as

<rule name="Unlock" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="Members/Unlock.aspx" />
        <add input="{QUERY_STRING}" pattern="contentID=([^&amp;]+)" />
      <action type="Redirect" url="Unlock" redirectType="Found" appendQueryString="True" />

I don't get any errors but the action is not being called. This is an MVC Core project on an Azure Website.