Vladan Strigo
Vladan Strigo

Reputation: 551

IIS Url Rewrite maps from custom provider?

Is it possible to access a dictionary or something of a certain rewrite map from your rewrite custom provider?

Something like...{Provider:key,mapname}

which in code does something like {Mapname:key}

?

Upvotes: 2

Views: 1192

Answers (1)

kateroh
kateroh

Reputation: 4416

When you inherit from IRewriteProvider, in your Initialize() method you will get a Dictionary with all the settings:

public void Initialize(IDictionary<string, string> settings, IRewriteContext rewriteContext)
{
    ...
}

which comes from the following config section:


<system.webServer>
  <rewrite>
    <providers>
      <provider name="MyCustomRewriteProvider" type="MyCustomRewriteProvider.....">
        <settings>
          <!--add key="keyName" value="keyValue" /-->
        </settings>
      </provider>
    </providers>
  </rewrite>
  ...
</system.webServer>

You can refer to this article for detailed information on how to create a custom URL Rewrite provider:

Upvotes: 2

Related Questions