How to remove trailing slash using IIS Rewrite

Programming, error messages and sample code > IIS Rewrite
How to remove trailing slash using IIS Rewrite. Please use the example code below to remove trail slash from a URL.

ex:  Turn http://www.domain.com/abc/   to   http://www.domain.com/abc


<rule name="Remove trailing slash" stopProcessing="true"
  <match url="(.*)/$" /> 
  <conditions
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
  </conditions
  <action type="Redirect" redirectType="Permanent" url="{R:1}" /> 
</rule