提问人:travis 提问时间:8/18/2008 最后编辑:Communitytravis 更新时间:8/25/2012 访问量:1620
您使用什么 Url 重写器进行 ASP.Net?[已结束]
What Url rewriter do you use for ASP.Net? [closed]
问:
我查看了 ASP.Net 和 IIS 的几个 URL 重写器,想知道其他人使用什么,以及为什么。
以下是我使用过或看过的:
- ThunderMain URLRewriter:在以前的项目中使用,没有我们想要的灵活性/性能
- Ewal UrlMapper:在当前项目中使用,但源代码似乎被放弃了
- UrlRewritingNet.UrlRewrite:似乎是一个不错的库,但文档糟糕的语法让我感到不安
- UrlRewriter.NET:这是我目前的最爱,具有很大的灵活性,尽管注入替换正则表达式的额外函数稍微改变了标准的 .Net 正则表达式语法
- 托管 Fusion URL 重写器:我在之前关于堆栈溢出的问题中找到了这个问题,但还没有尝试过,从示例语法来看,它似乎无法通过 web.config 进行编辑
答:
如果我现在开始一个新的 Web 项目,我会考虑从头开始使用 MVC。这使用重写的 URL 作为标准。
System.Web.Routing 刚刚随 .NET 3.5 一起发布。
您可以在自定义 HttpModule 中使用 Request.RewritePath()
我更喜欢使用 IHttpHandlerFactory 实现,并且可以完全控制所有传入 URL 及其映射到的位置。
我以前在流量非常高的网站上使用过 UrlRewriting.NET - 它对我们来说效果很好。我相信开发人员是德国人,所以英文文档可能没有想象的那么好。我强烈推荐它。
我对 Ionic 的 ISAPI 重写过滤器有很好的体验,它与 ISAPI_Rewrite 非常相似,只是免费。两者都是以 mod_rewrite 为模型的,并且是 ISAPI 筛选器,因此无法在代码中管理它们,因为必须在 IIS 中设置它们。
+1 UrlRewritingNET.URLRewrite -- 在单个盒子上用于数百个服务/门户/站点,多年来没有问题!(@Jason——这就是你说的那个,对吧?
我也在个人网站上使用过这个 URLRewriter.NET,发现它很有趣。@travis,你对更改的语法是正确的,但一旦你习惯了它,它就很好。
评论
I just installed Helicon's ISAPI Rewrite 3. Works exactly like htaccess. I'm diggin it so far.
I used .NET URL Rewriter and Reverse Proxy with great success. It's almost on par with mod_rewrite and uses almost all of the same syntax's. The owner of the project is extremely helpful and friendly and the product works great. This gem provides both Rewriting and Proxy functionality, which many solutions don't offer. IMO, worth a look.
IIS 7 has an URL Rewrite Module that is fairly capable and integrates well with IIS.
评论
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.
评论
+1 for UrlRewritingNet.UrlRewrite too but why do I always need to end my URL with .aspx? I think it should be improved better regular expression partern.
Why do I always have to end with aspx in virtualURL localhost/Products/Beverages.aspx", "localhost/Products/Condiments.aspx". I just want to type localhost/Products/Beverages", "localhost/Products/Condiments" which look like MVC route.
This one look good but it is not working for my site. I still can't figure it out.
评论
.aspx
.*
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"));
}
上一个:除非共享,否则打印机不可用
下一个:如何组织数据集查询以提高性能
评论