asp.net-mvc-routing

Different controllers with the same name in two different areas results in a routing conflict

I have two areas: ControlPanel and Patients. Both have a controller called ProblemsController that are similar in name only. The desired results would be routes that yield /controlpanel/problems => MyApp.Areas.ControlPanel.Controllers.ProblemsController and /patients/problems => MyApp.Areas.Patients.Controllers.ProblemsController. Ea...

ASP MVC creating a sitemap

Is it possible to put this in a sitemap? routes.MapRoute("Event_Groep_Route", // Route name "{EventName_Url}/{GroepID}/{controller}/{action}/{id}", new { EventName_Url = UrlParameter.Optional, GroepID = UrlParameter.Optional, controller = "Home", action = "Index", id = UrlParameter.Optional }); Event...

ASP MVC Routing

Hi, now this is probably an stupid question but i'm new to mvc and can't seem to get it working. Here is what i would like to be able to do with the urls/routes: 1) www.domain.com/name/home/index 2) www.domain.com/home/index where both the home controllers are seperate controllers and the name part will very but all must go to the sam...

Routing Business Branches: Granular access control in ASP.NET MVC

How should ASP.NET MVC routes be structured to allow granular role-based access control to business branches? Every business entity is related to a branch, either by itself or via its parent entities. Is there an elegant way to authorize actions based on user-roles for any number of branches? 1. {branch} in route? {branch}/{controller...

Is it possible to have catchall followed by other parameters in a ASP.NET MVC Route?

I would like to create a route that looks something like this: routes.Add(new Route("{*url}/{action}.do/{id}", new MvcRouteHandler()) Is this possible? It seems like the catchall has to be last? ...

ASP.NET MVC 2 - Account controller not found

Hi all, I've recently created an ASP.NET MVC 2 application, which works perfectly in the development environment. However, when I deploy it to the server (123-reg Premium Hosting), I can access all of the expected areas - except the Account controller (www.host.info/Account). This then attempts to redirect to the Error.aspx page (www.ho...

Running ASP.NET MVC in a subdomain makes Html.ActionLink render broken links

I am running MVC in a subdomain http://test.domain.com which points to the /Test directory on my webhost4life account. Html.ActionLink("About", "About", "Home") it renders a link to http://test.domain.com/Test/Home/About -- which gives a 404 the link should be .. http://test.domain.com/Home/About is there a way to override A...

Handling MVC2 variables with hyphens in their name

I'm working with some third-party software that creates querystring parameters with hyphens in their names. I was taking a look at this SO question and it seems like their solution is very close to what I need but I'm too ignorant to the underlying MVC stuff to figure out how to adapt this to do what I need. Ideally, I'd like to simply r...

How do you set up a default route to an area?

I have a folder called areas, in it I have 2 folders (Admin and Portal). How would I need to set up my Default route so when I start the site at the root site it routes it to Portal/Home/Index action? ...

Persisting querystring parameter throughout site in ASP.Net MVC 2

http:www.site1.com/?sid=555 I want to be able to have the sid parameter and value persist whether a form is posted or a link is clicked. If the user navigates to a view that implements paging, then the other parameters in the querystring should be added after the sid. http:www.site1.com/?sid=555&page=3 How can I accomplish this in As...

How Does One Differentiate Between Routes POSTed To In Asp.Net MVC?

I have two actions, one that accepts a ViewModel and one that accepts two parameters a string and an int, when I try to post to the action, it gives me an error telling me that the current request is ambiguous between the two actions. Is it possible to indicate to the routing system which action is the relevant one, and if it is how is ...

MVC routing - why does my request not match the route?

Hi all, I'm making a request that I thought would be caught by my route, but there is no match. What am I doing wrong? Any comments appreciated, Anders, Denmark -- Url : EventReponse/ComingAdmin/386/01e71c45-cb67-4711-a51f-df5fcb54bb8b Expected match: routes.MapRoute( "Editing event responses for other user", ...

How can I ajax load new pages/views into MainContent when using a master page

Hello. Instead of using Html.ActionLink to load subpages into MainContent, I would like to load them with ajax. For example (taken from Site.Master): <%= Ajax.ActionLink("HOME", "Index", "Home", new AjaxOptions() { UpdateTargetId = "main" })%> <%= Ajax.ActionLink("ABOUT ME", "In...

Routing optional parameters with dashes in MVC

I've made an routing definition like this: routes.MapRoute("ProductSearch", "Search-{MainGroup}-{SubGroup}-{ItemType}", new { controller = "Product", action = "Search", MainGroup = "", SubGroup = "", ItemWebType = ""}); It is not working if the parameters are empty. Actually it resolves the url, so Url.Action method re...

Receiving 404 error when trying to get to MVC application in local IIS

I have an existing web site setup on my local IIS built with web forms setup in this format: -MainSite -Application1 -Application2 -Application3 There are separate applications in each location, so MainSite has an application, and Application1 has another application and so on. This way development on different applications ...

Built in method to encode ampersands in urls returned from Url.Action?

I am using Url.Action to generate a URL with two query parameters on a site that has a doctype of XHTML strict. Url.Action("ActionName", "ControllerName", new { paramA="1" paramB="2" }) generates: /ControllerName/ActionName/?paramA=1&paramB=2 but I need it to generate the url with the ampersand escaped: /ControllerName/ActionName/...

Personalization in ASP.Net MVC -- friendly URLs, and skinning

Hi everyone, I haven't delved into custom generation of friendly URLs in ASP.Net MVC, and was wondering if anyone had suggestions. For example, if John Smith were to create an account on www.example.com, I'd like for his homepage to read www.example.com/JohnSmith -- along with the option for him to choose his URL. The ideal is for thi...

Multiple Default Routes in ASP.NET MVC to different Default Actions

I have multiple controllers with different actions (no "Index" actions). The actions I consider "default" actions, are named differently. I want to create default routes for their names and have the first available action (from my list of default actions) executed if only the controller name is provided in the route. So, for example, I ...

asp.net mvc and portal like functionality

fHi, I need to build an site with some portal like functionality where an param in the request will indentify the portal. like so http:/domain/controller/action/portal Now my problem is if an portal doesn't exists there must be an redirect to an other site/page and an user can login in to one portal but if the user comes to an other po...

Simple ASP.NET MVC Routing question

Hi there, I have two pages in my simple MVC App with two defined routes: routes.MapRoute( "Results", // Route name "Results/{id}", // URL with parameters new { controller = "Results", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}",...