asp.net-mvc-routing

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...

ASP.Net MVC routing action name conflicts

Hi, We have a website that deals with artists and venues and we're developing it in ASP.net MVC. We have our artist views in a folder (Views/Artists/..), an ArtistsController, ArtistsRepository and adhere to the REST action names such as Show, New, Delete etc. When we first mocked up the site, everything worked well in our test enviro...

ASP.Net MVC routing legacy URLs passing querystring Ids to controller actions

Hi, We're currently running on IIS6, but hoping to move to IIS 7 soon. We're moving an existing web forms site over to ASP.Net MVC. We have quite a few legacy pages which we need to redirect to the new controllers. I came across this article which looked interesting: http://blog.eworldui.net/post/2008/04/ASPNET-MVC---Legacy-Url-Routi...

Adding a parameter to the URL in ASP MVC

I need to have a parameter as part of my ASP MVC URL before Controller and Action: http://www.mydomain.com/company1/Home or http://www.mydomain.com/company1/Clients/Detail/1 (Ideally I would like to have this as a sub-domain like this: http://company1.mydomain.com/Clients/Detail/1 so any answers solving this one is also appreciated) ...

Handling complex URLs in ASP MVC

I have - I think - a complex URL to deal with in ASP MVC 1.0: All my actions in most of the controllers require two parameters all the time: Account and Project. This is on top of each Action's requirements. This means a typical URL is like this: http://abcd.com/myaccount/projects/project_id/sites/edit/12 In this example: myaccount is...

How to get route "name" when in route controller

I'm using routing in asp.net to get nice URLs When I define routes in global.asax I create two distinct routes that use the same controller (c#): // Setup code for route a... routes.Add("routeb", routea); // Setup code for route b... routes.Add("routeb", routeb); (How) is it possible to determine from...

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...

How do I use Server.Transfer method in asp.net MVC?

I am trying to use it for Login page. if (Session["UserID"] == null) Server.Transfer("/Account/Login", true); But I get The Exception -> Error executing child request /Account/Login. ...

Custom ASP.NET MVC Route In Nested Folders

I want sub-folders in my MVC application, so the current routes just don't cut it. I've got a folder structure such as Views/Accounts/ClientBalances/MyReport.aspx and I'm wanting a URL such as http://myapp/Accounts/ClientBalances/MyReport. How do you achieve this with mapping routes? I've had a bash but I'm not very savvy with the...

ASP.NET MVC route for serverside imagemap

...

ASP.NET MVC: add to querystring on form submit

Hi guys, I'm building a grid in ASP.NET MVC and I have the following issue: Above the grid i have a column selector which lets people customize the columns being shown. This is a form with a submit button so that people can add/remove multiple columns at once without going trough multiple postbacks. Below the grid I have paging. This ...

Handle Invalid URL in MVC

How to handle invalid URLs in MVC? For ex.: When the user enters http://localhost/User/MyProfile instead of http://localhost/User/Profile, it will throw an exception. How to handle this request? ...

MVC, Dynamic routing, Unity, Determine if current controller exists in global.asax

What I'm trying to do is dynamic routing for my application. For instance, in Application_BeginRequest() I want to get the current controller and determine if it exists. If not, I want to add a set of routes that override the default routing so that my url looks like this mysite.com/term from database But, if the "term from databas...

ASP.NET MVC switch language, how to implement?

I have started converting my simple website to ASP.NET MVC, just to mess around with it. I have a switch language feature on there that basically sets the Session["language"] to another language and refreshes the page. Please correct me if this could be done better, but I have made two controllers for this and setting the session in ther...

Issue when trying to route a path that ends with a '.'

I'm trying to route a path like this: http://www.wikipediamaze.com/wiki/Washington,_D.C. The routing framework is not picking this up as a valid route and giving me a "Cannot find resource" error. Anyone know how I can get around this? It's not even getting to my controller factory so it's as if it doesn't even recognize it as a route...

Extending Asp.Net MVC routing mechanism

I've found a limitation in the routing mechanism for ASP.Net mvc and I'm trying to find a workaround. I posted a related question here about the issue I was having. The gist of the problem is that routes that end with a . (period) are never handled by the default routing mechanism. A "Resource Cannot Be Found" error is always thrown. ...

ASP.NET MVC Default route?

I created a new ASP.NET MVC project and implemented a site authorization filter. When I map the routes to the {controller}/{action} pair, I pass a role = "SomeRole" default to the route. It works perfectly if I go through the full url (http://localhost/somecontroller/someaction) and I specified the full route [ MapRoute("SomeAction",...

How to remove 'Details' in MVC URL Routing, but leave other actions intact?

I would like to set up a route for a controller that has the normal CRUD operations, but would like the Details action not show 'Details' in the URL. Stackoverflow seems to have this type of routing configured: http://stackoverflow.com/questions/999999/ http://stackoverflow.com/questions/ask Using this analogy, my routes currently loo...

What happened to Html.ActionLink<TController> in ASP.NET MVC?

I'm reading all of these blogs about using the Html.ActionLink method with lambda expressions. I even saw a ScottGu presentation about it here: http://www.hanselman.com/silverlight/ScottGuAtAltNetConf/ Here's a blog: http://blog.wekeroad.com/blog/aspnet-mvc-preview-using-the-mvc-ui-helpers/ Here's a ScottGu blog about it: http://weblo...

How can I access a server-side control in a codebehind in my MVC project?

First and foremost let me state that I know that accessing server side controls in my View is frowned upon in MVC. However, I need to in my situation (as far as I can see). Here is my story. :) I have a 3rd party control that I'm using in my web application. I've currently been given the task to port our WebForms solution to MVC. This p...