asp.net-mvc-routing

ASP.NET MVC 2 Areas and route priority

Is it possible to set route priority in asp.net mvc 2 using arearegistration? I have a catch all {*pagePath} route which I want to set the lowest priority on. ...

Dynamically generating many routes in ASP.NET MVC... is this a totally bad idea?

Here is my dilemma. I have a collection of entities that I want to use to define as the starting point for a set of routes. For example, I want to give all of the users in my site their own "subsites" of the form mydomain.com/username, and then hang all of the UserController actions off of that. Here is a rough example of what I am doi...

asp.net mvc dynamic/relative routing

I'm developing a website which has a modular structure. Every segment of the url presents an content item. For example url: www.mysite.com/blogs/programming/2010/01/ Root item is 'blogs' of type 'area'. It has a child item 'programming' of type 'blog'. Now there's '2010/01' left of the url. Last valid (routable) item 'programming' was ...

ASP.NET MVC view locations and routing

Hi guys I have a base controller that I use to return basic views like this. public ActionResult Index(string pageName) { return View(pageName); } public ActionResult LanguageSpecific(string ul, string pageName) { var result = View("sv/" + pageName); return View(...

Redirect problem

I have this code in the client side: $.post('<%=Url.Action("Action_Name","Controller_Name")%>', { serverParam: clientParam}, null, null); And this code in the server side: [HttpPost] public ActionResult Action_Name(string serverParam) { return View(); } I currently am in a view and when i click a button i want to be redirected ...

How to route MVC URL mistakes to a view of our choice?

If we use this standard route: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); and within Windows 2008 IIS7 with MVC 2 setup ...

Link to a root controller from area controller in ASP MVC

How can I link to one of my root controllers from one of my areas? <% Html.RenderAction("Action", "Page", new {area = "root", name = "Admin"}); %> This gives me an error: No route in the route table matches the supplied values. I have a controller named Pagein a folder named Admin in my root controller collection. I can reach th...

asp.net MVC - Default route doesn't appear to be working

Hi there, I have setup some routes and they work so if i put localhost/MyWebApp/Reservas ...... it works. I have setup up a default route that if somebody enter localhost/MyWebApp it should go directly to the Reservas route ... but it doesn't.. I have installed a route debugger and it appears nothing matches the request.. am i doing ...

Sorting, Filtering and Paging in ASP.NET MVC

What is the best approach to implement these features and which part of project would involved? I see some example of JavaScript grids, but I'm talking about a general approach which best fits the MVC architecture. I've considered configuring routes and models to implement these features but I don't have a clear idea that if this is th...

Ambiguous Actions

Is there any way to have multiple actions with different parameters? I've seen it using the HttpPost verbs flag, but it doesn't seem to work for me in other places. The current request for action List on controller type FoldersController` is ambiguous between the following action methods. public ActionResult List() { //... } publi...

ASP.NET MVC : strange POST behavior

ASP.NET MVC 2 app I have two actions on my controller (Toons): [GET] List [POST] Add App is running on IIS7 integration mode, so /Toons/List works fine. But when I do POST (that redirects to /Toons/List internally) it redirects (with 302 Object Moved) back to /Toons/Add. The problem goes away if I use .aspx hack (that works ...

How to route GET and DELETE requests for the same url to different controller methods

Here are my routes in Global.asax routes.MapRoute("PizzaGet", "pizza/{pizzaKey}", new { controller = "Pizza", action = "GetPizzaById" }); routes.MapRoute("DeletePizza", "pizza/{pizzaKey}", new { controller = "Pizza", action = "DeletePizza" }); Here are the my controller methods [AcceptVerbs(HttpVerbs.Get)] public Action...

QueryString id parameter not being used

I've got a very basic ASP.Net MVC project where I'd like to use a parameter name of id on one of my controller actions. From everything I've read that shouldn't be a problem but for some reason using a parameter name of id fails to get the value extracted from the query string but if I change it to any other different name it will work. ...

Two different generic route types...

Hi, I've got two (so far) different types of routes in my ASP.NET MVC app, one is: {controller}/{action}/{id} and the other {controller}/{action}/{title} Currently I need to define the routes like this: routes.MapRoute ( "Default_Title_Slug", // Route name "product/...

How do I use a custom constraint with a HttpMethodConstraint in ASP.NET MVC routing?

I have a controller that only accepts a POST on this URL: POST http://server/stores/123/products The POST should be of content-type application/json, so this is what I have in my routing table: routes.MapRoute(null, "stores/{storeId}/products", new { controller = "Store", action = "Save" }, ...

Create url based on mapped route or constraint?

I'm creating a generic editor for asp.net mvc pages and would like to generate/create urls when I create new items of a specific type. My editor is located under mysite.com/dashboard and I load different models into the same views using the same generic DashboardController. So how can I create urls based on the mapped route or constraint...

How to use QueryString

How can I have different URL ids like www.somewebsite.com/index?theidentifier=34 only in ASP.NET MVC not Webforms. ...

How to make ASP.NET Routing escape route values?

I have an ASP.NET MVC site where I want routes like /{controller}/{id}/{action}/{date}, where "date" is the mm/dd/yyyy portion of a date/time. (I'm dealing with time-dimensioned data, so I need both an ID and a point in time to do most operations) The route for this is simple: routes.MapRoute( "TimeDimensionedRoute", "{controll...

Parameter ok in RouteData but passed as null in controller

I'm a few weeks into MVC now, and each day, something new pops up which strikes me as quite odd. So, I try to find answers to the issues I'm facing. None the less, for the current issue, I can't seem to find a descent answer here on stackoverflow, or anywhere on google for that matter... I'm having an issue passing parameters to my cont...

ASP.NET MVC 2 | Load Area at Runtime

I'm trying to figure out the best way (or if it is possible) to decide if an Area should be loaded based on some runtime parameter. I only want certain Areas available in certain situations. Is there a "best practices" around this. A better way to ask this question may be, can you register the routes of an area at Runtime or Session_St...