Custom Rewrite Provider for URL Rewrite Module

2020-04-21 02:48发布

问题:

I have a Custom Rewrite Provider for URL Rewrite Module running in IIS, I use to redirect request based on my custom logic.

It is based on this: http://www.iis.net/learn/extensions/url-rewrite-module/developing-a-custom-rewrite-provider-for-url-rewrite-module

How can I access input header from my code?

回答1:

So found the answer, it uses a naming convention:

Server variables can also be used to access HTTP headers from the current request. Any HTTP header supplied by the current request is represented as a server variable that has a name generated in accordance to this naming convention:

All dash ("-") symbols in the HTTP header name are converted to underscore symbols (""). All letters in the HTTP header name are converted to capital case. "HTTP" prefix is added to the header name.

in my case, I ended up with something like this in my Action Properties \ Redirect URL: {RoutingProvider: {QUERY_STRING}|{HTTP_ORGANISATIONID}}

HTTP_ORGANISATIONID is my custom header.

Thanks