What Url rewriter do you use for ASP.Net? [closed]

2019-03-12 16:52发布

I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why.

Here are the ones that I have used or looked at:

  • ThunderMain URLRewriter: used in a previous project, didn't quite have the flexibility/performance we were looking for
  • Ewal UrlMapper: used in a current project, but source seems to be abandoned
  • UrlRewritingNet.UrlRewrite: seems like a decent library but documentation's poor grammar leaves me feeling uneasy
  • UrlRewriter.NET: this is my current fav, has great flexibility, although the extra functions pumped into the replacement regexs changes the standard .Net regex syntax a bit
  • Managed Fusion URL Rewriter: I found this one in a previous question on stack overflow, but haven't tried it out yet, from the example syntax, it doesn't seem to be editable via web.config

11条回答
小情绪 Triste *
2楼-- · 2019-03-12 17:19

asp.net routing serves the requirement of url rewriting as well and even much more than. With asp.net routing you can not just "rewrite the url" but create custom handlers for various requests. asp.net routing however requires at least asp.net sp1.

The basic thing that you do for a simple routing to work is add a few route handlers in the Application_Start even inside the Global.asax.cs file.

 protected void Application_Start(object sender, EventArgs e)
        {

                        RegisterRoutes(RouteTable.Routes);


        }
        private static void RegisterRoutes(RouteCollection routes)
        {          

            routes.Add("Routing1", new Route("/Blog/id/2","/Blog.aspx"));

        }
查看更多
别忘想泡老子
3楼-- · 2019-03-12 17:21

There's System.Web.Routing that was just released with .NET 3.5.

You can just use Request.RewritePath() in a custom HttpModule

I prefer using an IHttpHandlerFactory implementation and have full control over all incoming URLs and where they're mapped to.

查看更多
迷人小祖宗
4楼-- · 2019-03-12 17:26

I would not recommend UrlRewritingNet if you are in an IIS7 Windows 2008 environment.

Reason: UrlRewritingNet requires that you app pool mode = Classic and NOT integrated. This is not optimal Also, their project seems very dead that last 2 years.

查看更多
疯言疯语
5楼-- · 2019-03-12 17:27

+1 UrlRewritingNET.URLRewrite -- used in several hundred services/portals/sites on a single box without issue for years! (@Jason -- that is the one you're talking about, right?)

and I've also used the URLRewriter.NET on a personal site, and found it, ah, interesting. @travis, you're right about the changed syntax, but once you get used to it, it's good.

查看更多
SAY GOODBYE
6楼-- · 2019-03-12 17:28

I just installed Helicon's ISAPI Rewrite 3. Works exactly like htaccess. I'm diggin it so far.

查看更多
啃猪蹄的小仙女
7楼-- · 2019-03-12 17:33

IIS 7 has an URL Rewrite Module that is fairly capable and integrates well with IIS.

查看更多
登录 后发表回答