SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URL Re-writing for SEO on ASP.NET 2.0 Windows Sever

    Hi,

    I was wondering what the best method is for re-writing query string URL's, to perfect URL's, on a windows server using ASP.NET 2.0 with minimum server overhead.

    EG www.website.com?product=hotels&location=london to:

    www.website.com/hotels/london/

    Thanks for your help.

  2. #2
    SitePoint Addict ServerUnion's Avatar
    Join Date
    Jan 2005
    Location
    madison, WI
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you looked into ISAPIrewrite (spelling???). That is the windows version of mod_rewrite.

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    With IIS 6 and ASP.NET 2.0 it is very doable. What you will need to do is setup a wildcard mapping so that all requests hit the ASP.NET engine. Then override the OnMapUrl method (name might be off, don't have any references in front of me) to override the incoming urls.

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another idea would be using the Global.asax and catch custom URLs like e.g. that way:

    PHP Code:
          string RawUrlPath Request.RawUrl.ToString();
            
    int PrIndex RawUrlPath.IndexOf("MyCustomString");
            if (
    PrIndex 0)
            {
                
    string PR RawUrlPath.Substring(341); // 48 34
                
    if (HttpContext.Current.Request.QueryString["Page"] != null)
                {
                    
    string Page HttpContext.Current.Request.QueryString["Page"].ToString();
                    
    Context.RewritePath("page.aspx?PR=" PR "&Sort=None&Page="+Page+"");
                } 

  5. #5
    SitePoint Enthusiast RageMan's Avatar
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    url rewriter

    Hey,

    I've been playing with a commercial urlrewriter - you can download a trial version from http://urlrewriter.net. The trial one is locked down to localhost only which means I can't trial it on a production site, but the functionality I've seen in playing with it is pretty cool.

    There is also a lesser, free one I saw at http://www.urlrewriting.net, but I gave up on it.

    If you want to roll your own I have some code on my blog you can rip off here: http://mark.silverbullet.com.au/index.php?itemid=21 I have used this in a few projects, always with success. A word of warning: If you rewrite urls you will have problems with submitting forms from pages where you've rewritten the url. You'll get an error message about the viewstate being corrupted. Have a look here for my fix (code is there, just rip it off):

    http://mark.silverbullet.com.au/inde...unt=0&blogid=1

    Have fun ;o)

    Mark

  6. #6
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I've used IISReWrite
    Sara

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Ballymena
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I, too, have been using IISReWrite with a huge amount of success - it's a very clever little tool.

  8. #8
    SitePoint Enthusiast RageMan's Avatar
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IISREwrite looks a bit pricy - twice the price of http://urlrewriter.net - is it worth that much?

    I can tell you one thing for certain, my home-grown rewriter has gotten so big and clunky it's become a pain to maintain

  9. #9
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by RageMan
    IISREwrite looks a bit pricy - twice the price of http://urlrewriter.net - is it worth that much?

    I can tell you one thing for certain, my home-grown rewriter has gotten so big and clunky it's become a pain to maintain
    Depends. A friend bought a dedicated Windows box and it was included in the deal. I pay him for space. So, it was included.
    Sara

  10. #10
    SitePoint Enthusiast RageMan's Avatar
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    urlrewriter.net

    Hi,

    since I wrote the above I see http://urlrewriter.net is now open source and free. It's been getting a lot of attention on a lot of developer blogs

    Mark


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •