routing

What is the best method to achieve dynamic URL Rewriting in ASP.Net?

I'm currently using Intelligencia.UrlRewriter does anyone have better suggestions? ...

Pretty URLs for search pages

I really enjoy having "pretty" URLs (e.g. /Products/Edit/1 instead of /products.aspx?productID=1) but I'm at a loss on how to do this for pages that let you search by a large number of variables. For instance, let's say you have a page that lets a user search for all products of a particular type with a certain name and near a specific ...

Is it possible to use Castle MonoRail Routing feature with IIS 5?

Do I have to go with IIS 6 or higher to use Castle MonoRail Routing feature? I know casini work but practically we not gonna deploy web app with casini, or do we? ...

How do I fix routing errors from rails in production mode?

If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message Routing Error No route matches "/asdfasdifjasdfkj" with {:method=>:get} Even though I am in production mode. Clearly I don't want any real users to see this, and would prefer a 404 page. Anyone know what...

Is the PageAction.Details route necessary in the default Dynamic Data template?

In the default Visual Studio template for a dynamic data web application, Global.asax includes the following two sample routes. // route #1 routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx") { Action = PageAction.List, ViewName = "ListDetails", Model = model }); // route #2 routes.Add(new DynamicDataRoute("{table}/...

Asp.Net MVC: How do I get Html.ActionLink to render integer values properly?

Hey all, I have an asp.net mvc application with a route similar to: routes.MapRoute("Blog", "{controller}/{action}/{year}/{month}/{day}/{friendlyName}", new { controller = "Blog", action = "Index", id = "", friendlyName="" }, new { controller = @"[^\.]*", year = @"\d{4}", mo...

Asp.Net MVC: How do I get virtual url for the current controller/view?

Is it possible to get the route/virtual url associated with a controller action or on a view? I saw that Preview 4 added LinkBuilder.BuildUrlFromExpression helper, but it's not very useful if you want to use it on the master, since the controller type can be different. Any thoughts are appreciated. ...

Trailing slash on an ASP.NET MVC route

In the latest MVC preview, I'm using this route for a legacy URL: routes.MapRoute( "Legacy-Firefox", // Route name "Firefox-Extension/", // URL with parameters new { controller = "Home", action = "Firefox", id = "" } // Parameter defaults ); The problem is that both of these URL's work: http://mysite.com/Firefox-Extension http://mysit...

State Service when using system.web.routing in WebForms

I am using the System.Web.Routing assembly in a WebForms application. When running the application deployed on win2008/IIS7 I got the following message. Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModu...

Using Linux, how to specify which ethernet interface data is transmitted on

I'm working on a Linux based server system in which there are two network interfaces, both on the same subnet (for now, lets just say they are 172.17.32.10 & 172.17.32.11). When I send data to a host on the network, I would like to specify which interface on my server the data is transmitted on. I need to be able to switch from one int...

Default segment name in rails resources routing

I want to create a route in my rails application along the lines of /panda/blog /tiger/blog /dog/blog where panda, tiger, and dog are all permalinks (for an animal class) The normal way of doing this map.resources :animals do |animal| animal.resource :blog end would create routes along the lines of /animals/panda/blog /animals/t...

Why is Mongrel failing to pick up the correct HTTP verb?

I have an extremely simple routes.rb in my Rails app: ActionController::Routing::Routes.draw do |map| map.resources :tags end Starting up my app with script/server and pointing my browser to localhost:3000/tags/ yields: ActionController::MethodNotAllowed Only get and post requests are allowed. ... Starting up my app with script...

How to create a route like "/x/{*path}/y" in ASP.NET routing?

I have routes like "x/{*path}" where the path parameter is used by the controller to navigate a tree structure to end up with a resource which is served to the client. I would now like to extend this scheme in an orthogonal fashion with other controllers that provide other "aspects" of the resource such as meta-data or a thumbnail. It s...

How do you use querystrings with ASP.NET routing?

The new ASP.NET routing is great for simple path style URL's but if you want to use a url such as: http://example.com/items/search.xhtml?term=Text+to+find&page=2 Do you have to use a catch all parameter with a validation? ...

Image equivalent of ActionLink in ASP.NET MVC

In ASP.NET MVC is there an equivalent of the Html.ActionLink helper for Img tags? I have a controller action that outputs a dynamically generated JPEG and I wanted to use the same Lambda expressions to link to it as I do HREFs using ActionLink. Alternatively, a helper that just gives the URL to a route (again specified using Lambdas) ...

ASP.NET MVC URL generation performance

A little benchmark with ASP.NET MVC. Viewpage code: public string Bechmark(Func<string> url) { var s = new Stopwatch(); var n = 1000; s.Reset(); s.Start(); for (int i = 0; i < n; i++) { var u = url(); } s.Stop(); return s.ElapsedMilliseconds + "...

Creating routes with an optional path prefix

How can I go about making my routes recognise an optional prefix parameter as follows: /*lang/controller/id In that the lang part is optional, and has a default value if it's not specified in the URL: /en/posts/1 => lang = en /fr/posts/1 => lang = fr /posts/1 => lang = en EDIT Ideally, I'm looking to do this across many c...

ActionLink fails with ViewData parameter in ASP.NET MVC Beta

I have ran into an odd problem with the ActionLink method in ASP.NET MVC Beta. When using the Lambda overload from the MVC futures I cannot seem to specify a parameter pulled from ViewData. When I try this: <%= Html.ActionLink<PhotoController>(p => p.Upload(((string)ViewData["groupName"])), "upload new photo") %> The HTML contains a ...

HttpContext.Current.Session is null when routing requests

Without routing, HttpContext.Current.Session is there so I know that the StateServer is working. When I route my requests, HttpContext.Current.Session is null in the routed page. I am using .NET 3.5 sp1 on IIS 7.0, without the MVC previews. It appears that AcquireRequestState is never fired when using the routes and so the session variab...

Strongly typed actionlink with asp.net mvc beta?

I used to be able to do the following in Preview 3 <%=Html.BuildUrlFromExpression<AController>(c => c.AnAction(par1, par2)%> How am I supposed to create urls in a strongly typed way with the MVC Beta? The only thing so far I have found is <%= Html.ActionLink("aName", "ActionName", "ControllerName")%> This is not strongly typed off...