routing

ASP.NET MVC Routing construct links based on current url

I have urls that look like this ~\articles\energy\topweek ~\articles\metals\latestpopular where second url string is a category and third is a filter so route looks like this routes.MapRoute("ArticleFilter", "articles/{category}/{filter}", new { controller="Article", action="Filter" }) That's pretty easy and everything ...

asp.net mvc multiple values to route

Hi guys, is there a way to send multiple parameters to controller as one parameter? for example, if I have route: {controller}/{action}/{languages} can parameter languages be array of strings? if it does, how to use it...how to send array to controller and how to parse it in controller method? thanks Marko ...

From within a Controller's action, how can I get the current route information?

From within a Controller's action, how can I get the current route information? How can I loop through the other routes? ...

ASP.NET MVC How-to use routes when application is published as SubProject of a domain?

Hi, i have a webapp which works perfectly when debugged and tested locally. However when I publish the site to a productionserver the routing is messed up. This is because it runs as a sub-project on the productionserver. Testing: http://localhost:xxx/ Production: http://remotehost/webapp/ How should I setup routing? This is m...

Issue with Default and catchall routes

I define a lot of explicit routes. One of them is: routes.MapRoute("default", "", new { controller = "Home", action = "Index" }); At the end, I define a catchall route: routes.MapRoute("PageNotFound", "{*url}", new { controller = "Error", action = "Http404" }); If I go to the homepage http://localhost, then the http404 page is ...

path_prefix for asp.net mvc routes

Hi, I read this article about how you can prefix routes in ruby on rails. I want to be able to do the same thing with asp.net mvc So I want to be able to define a route like : /photographers/1/photos/2 //photo 2 of photographer with id 1 /photographers/1/photos //all of photographer with id 1 Any tips ? EDIT: "photographers/...

Space in routing gives 404

Hi there. I currently have this route defined (among others): "{controller}/{action}/{id}/{designation}" being: "id" my primary key "designation" only used for SEO and not taken into account. now my problem is: "http://server/Home/Index/1/teste" works but "http://server/Home/Index/1/teste " with a space in the end doesn't. IIS is g...

Error when accessing anything but default route

I am having trouble getting routing to work on mono. The default route works fine but nothing else does. These are the routes I have setup: routes.MapRoute( "HelloRoute", "Hello/{name}", new { controller = "Home", action = "Hello" } ); routes.MapRoute( "Default", ...

How do I redirect to the previous action in ASP.NET MVC?

Lets suppose that I have some pages some.web/articles/details/5 some.web/users/info/bob some.web/foo/bar/7 that can call a common utility controller like locale/change/es or authorization/login How do I get these methods (change, login) to redirect to the previous actions (details, info, bar) while passing the previous parameters...

How Can I Reconstruct URL/Route in ASP.NET MVC From Saved Data?

My unfamiliarity with the ASP.NET MVC framework and the plumbing thereof has brought me here, and I appreciate the patience it will take for anyone to read and consider my question! Okay, here is the scenario: I have an application that has numerous pages with grids that display data based on searches, drilling down from other data, rep...

Returning an Action route another MVC project

I'm currently creating an admin tool for a new project which I would like to use to retrieve a url from a different project in my solution. Although the product controller doesn't exist in the project I am calling it from, I would like to retrieve it from the first project. Is this at all possible, or would I need to create some sort o...

MVC Routing - Use route part to switch views...

I have a series of URLs that look like /Catalog/Ajax/Update/{ViewToUpdate}?var1=a&var2=b&var3=c Currently I've setup several routes - one for each {ViewToUpdate} and what I'd like to do is pass the {ViewToUpdate} to my Action handler so I can condense my code. Instead of: public ActionResult AjaxUpdateNavigation(string var1, string...

ASP.NET 3.5 Routing Not Handling / (Root URL)

I'm using the new routing functionality in ASP.NET 3.5 to act as my catch-all for page requests to my website. I've registered my route as follows within the global.asax, <%@ Application Language="C#" %> <%@ Import Namespace="System.Web.Routing" %> <script runat="server"> void Application_Start(object sender, EventArgs e) { ...

Server prefix and rails routes

When i'm starting the server with the path option script/server --path=/myapp while having a route map.route 'foo', :controller => 'bar', :action => 'buzz' then ActionController::Routing::Routes.recognize_path('/myapp/foo') raises an error "No route matched ..." Question: How can i make Rails built-in routing recognize with p...

Dynamic Route Creation thru Xml File

I'm loading a special set of routes form an XML file. Those rotes must be created in my application for compatibility reason with the previous version of my application. Initially, the first version where wrote in .net 1.1, and I must create some routes to fully support "old" urls to the new ones. The application has been full rewrited ...

In ASP.NET MVC, how to receive the parameter dictionary in an action?

Most of the actions in my controller have statically-defined parameter lists and so they correspond nicely with the standard tutorial examples: public ActionResult SomeAction(string id, string arg1, string arg2) { // use arg1, arg2... } But I have one troublesome case where the view puts together a form dynamically, so the set of ...

In CakePHP, is it possible to have internal and external routes?

A Facebook app is hosted on my server at, say, http://server.com/projects/fbapp/, but is only ever viewed in Facebook at, for instance, http://apps.facebook.com/fbapp/. Using CakePHP this presents a problem - should routes be prefixed with "/project/fbapp" or just "fbapp"? It's a problem because routes are used not just for routing inb...

How can I change the way MVC renders an action link dynamically?

I need to change the way MVC is rendering action links(and form's and url's, etc) based on a configuration setting. I am writing a facebook application using MS MVC and my action links need to render link so: <a href="/MyFBApplication/Home/Index/">home</a> clicking the above link would browse to: http://apps.facebook.com/MyFBApplicati...

ASP.net MVC: get "Main-Controller" in RenderAction

How can I get the actual "Main-Controller" in a RenderAction? Example: MyRoute: {controller}/{action} My url my be: pages/someaction tours/someaction ... In my Site.Master I make a RenderAction: <% Html.RenderAction("Index", "BreadCrumb"); %> My BreadCrumbController Action looks like this: public ActionResult Index(string cont...

how do you make it so that www.site.com/123 or www.site.com/123/some-headline will both lead users to the same place which is www.site.com/123 ?

how do you make it so that www.site.com/123 or www.site.com/123/some-headline www.site.com/123/anything-at-all will lead users to the same place which is www.site.com/123 ? I think the routing in Ruby on Rails can do it. But other than that, what other methods can do that. can it be done by Apache alone? ...