/IIS-URL-Rewrite-ServerNameProvider

IIS URL Rewrite variable to display the hosts machine name in the response header

Primary LanguageC#GNU General Public License v3.0GPL-3.0

IIS URL Rewrite ServerNameProvider

IIS URL Rewrite variable to display the hosts machine name in the response header.

See "server-name" header below:
Header-Pic

Usage

Installation

Perform the following actions on the IIS server

  1. Download IIS-URL-Rewrite-ServerNameProvider DLL to C:\Temp
  2. Copy NETFX-4.8-Tools to C:\Temp
  3. Run the following PowerShell command to register assembly to the Global Assembly Cache (GAC): & 'C:\Temp\NETFX-4.8-Tools\gacutil.exe' -i "C:\Temp\IIS-URL-Rewrite-ServerNameProvider.dll"
  4. (Optional) Run the following PowerShell command to view the contents of the GAC: & 'C:\Temp\NETFX-4.8-Tools\gacutil.exe' -l
  5. Open IIS -> URL Rewrite (either at server level or site level) IIS-1.png
  6. Select "View Providers..."
  7. Select "Add Provider..."
  8. Select the provider from the dropdown and then copy over the name that is listed to the name field IIS-2.png IIS-3.png
  9. Go back to URL Rewrite and select "Add Rule(s)..."
  10. Select a "Blank rule" IIS-4.png
  11. Edit the Outbound Rule as shown below
    IIS-5.png IIS-6.png
  12. Restart the IIS server

Compiling

Note: In order to build the DLL you will need the Key.snk file which can be found here

  1. Clone the repository to your local disk
  2. Add the Key.snk file to the repository
  3. Open solution in Visual Studio 2017 or greater
  4. Simply select Build>Build Solution from the top menu