1

i've bought a shared hosting on a windows hoster with IIS 6.

I would like to know how to rewrite url.

I can't modify anything on the server, the only thing i can do is to use ... my asp.net code ! some advice ?

Thanks!

stighy
  • 7,260
  • 25
  • 97
  • 157
  • 2
    Take a look at: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx – Steve Apr 26 '10 at 16:50
  • thanks, but i've already look at that post and but i can't find a solutions for iis 6 ! :( – stighy Apr 26 '10 at 21:16

1 Answers1

1

As the ScottGu blog suggests, you can

1. Do the rewrite manually using the HttpContext.RewritePath() method that ASP.NET provides

void Application_BeginRequest(object sender, EventArgs e) {

    string fullOrigionalpath = Request.Url.ToString();

    if (fullOrigionalpath.Contains("/Products/Books.aspx")) {
        Context.RewritePath("/Products.aspx?Category=Books");
    }
    else if (fullOrigionalpath.Contains("/Products/DVDs.aspx")) {
        Context.RewritePath("/Products.aspx?Category=DVDs");
    }
} 

2. Use a HttpModule
Using a HttpModule (such as urlrewriter.net) does not require any changes on the server, only some changes on Web.Config and deploying the module DLLs

Eduardo Molteni
  • 38,786
  • 23
  • 141
  • 206