1

The real url is http://www.example.com/site.aspx?site=google.com i want to the rewrite result more friendly. like this: http://www.example.com/google.com in C# code, i don't want to use third-party lib only use RewritePath method or some code

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262
alex
  • 11
  • 1
  • Which "RewritePath" method are you talking about? – John Saunders Jul 14 '11 at 19:37
  • 2
    May I strongly suggest that you choose something other than xxx.com for your example domain name? Unless you're advertising their... um... services. Example.com is usually a safe bet. – Michael Ames Jul 14 '11 at 19:38
  • you're using asp.net? Why don't you just create a route that includes `/google.com` instead of using that rewriting stuff in the first place? – CodesInChaos Jul 14 '11 at 19:49

2 Answers2

0

I'm not sure I understand all of your requirements, but why couldn't you simply to a string.Replace(), or a regular expression if you could have other parameters in your query string as well.

Philipp Schmid
  • 5,778
  • 5
  • 44
  • 66
0

There are some examples about how to rewrite, including this one.

You could also download the source code of URL Rewriter and see how the author does it.

Personally, I'm very satisfied with using URL Rewriter (binaries) in several of my projects.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291