« Previous Next »

Answered Thread: Replacing characters in URL

Last post 11-03-2009 1:07 PM by ruslany. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 11-03-2009, 9:41 AM

    Replacing characters in URL

    I want to replace all instances of an embeded space %20 with an underscore. I don't see anything here that would allow a URL with encoded spaces such as http://localhost/folder/this%20is%20my%file.aspx to http://localhost/folder/this-is-my-file

    Any ideas?
    Thanks,
    Michael

  • 11-03-2009, 1:07 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 670

    Answered Re: Replacing characters in URL

    Unfortunately, I can not think of a simple way in URL rewrite to replace all character occurances in a string with some other character. The URL rewrite uses regex for string manipulation. If you know for sure how many occurances of the %20 there will be then you can create a regex pattern for that. But if the number of occurances is unknown and varies from request to request, then I cannot think of a regex pattern that could do this.

    http://ruslany.net
Page 1 of 1 (2 items)
Microsoft Communities