Remove trailing slash from url
In your web.config under system.webServer
add
<rewrite>
<rules>
<!--To always remove trailing slash from the URL-->
<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>
</rules>
</rewrite>
Some Gotchas
In your development environment, if you run your website under Visual Studio Development Sever, you won't be able to see this feature. You will need to configure your application to run on at least IIS Express.
When you deploy your website and see that this feature is not working on your production server, it will be because you are missing something. One of the common mistakes is that the attribute is overrideModeDefault
set to Deny
for rules under <sectionGroup name="rewrite">
inside your applicationHost.config file.
If you are in a shared hosting environment and see this feature is not working, please contact your ISP if they have given you permission to configure this part.
source to share