Reputation: 1800
How would I substring the request url in a rewrite config?
For example:
www.domain.com/some-request)
->
www.domain.com/some-request
Just removing one letter from the end of the url.
Edit: I want to be able to do this from the url rewrite module config like so:
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" /></conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
Upvotes: 1
Views: 304
Reputation: 14618
Like so:
string url = "www.domain.com/some-request)";
string sub = url.Substring(0, url.Length - 1);
Or if you know the last character will always be a )
, just do:
"www.domain.com/some-request)".TrimEnd(')');
Upvotes: 1