asp.net-mvc-routing

Routing error using MVC on iis 5.1

I am using .NET MVC 2 with Windows XP (IIS 5.1). I have set up wildcards per this blog. The problem I run into is sometimes when I call some of my actions, they are returning 404 errors. Here's how I'm calling them (using a button): <% using (Html.BeginForm("MyController", "MyAction")){ %> <input type="submit" value...

MVC 2.0 Routing Issue - Url parameter not recognized

In my AccountController class I have the following: public ActionResult Verification(string userGuid) { Debug.WriteLine(userGuid); ... In my global.asax I have: routes.MapRoute( "AccountVerification", "{controller}/{action}/{userGuid}", new { controller = "Account", action = "Verification", userGuid = UrlParameter....

LockRecursionException calling Route.GetVirtualPath from another route's GetVirtualData in .Net 4

I have a route defined last in my ASP.Net MVC 2 app that will map old urls that are no longer used to the appropriate new urls to be redirected to. This route returns the action and controller that is responsible for actually performing the redirect and it also returns a url to the controller action which is the url to redirect to. Since...

Re-use route parameter on url

How do I make my application route to mydomainname/username/controller. I am working on asp.net mvc web application that enables a user to belong to multiple account. ie. In the application every account has its own users, and each user in one account can also be a user in another account. What i need is when a user wants to login, the...

Getting MVC to ignore route to site root

I'm working on a site that is partially static content and partially MVC. The root of the site is index.html and I have all of the controllers explicitly routed and all html files ignored. However, when you hit the root of the website, it tries to route it. How can I tell the route engine to ignore the root of the site? www.mysite.com...

Pass an & as Part of a Route Parameter

Unfortunately I need to accept a route parameter with an & in it. I have this route definition. The id parameter will sometimes have an & in it like this X&Y001. routes.MapRoute( "AffiliateEdit", "Admin/EditAffiliate/{*id}", new { controller = "UserAdministration", action = "EditAffiliate", i...

MVC 2 routing question

I'm trying to create a route that looks like this site.com/controller/{Param1}/{dbID}-{friendly-name} and omit the default action index , and for the action edit to be at the end of the url like so site.com/controller/{Param1}/{dbID}-{friendly-name}/edit routes are a bit confusing for me , so any help is appreciated , Than...

Different routes on different machines in VS2008 IIS?

I have a funny problem I haven't been able to track down. On my development machine at work I'll have something like: $.getJSON('Action', ... However when I'm at home, I'll need to use this to get it to work: $.getJSON('Controller/Action', Nothing else changes and everything runs fine except for this. Both machines are pretty muc...

Personalized URL for each user using ASP.NET MVC

I'd like to create a site where each user has his own home page and where the URL is in the format site\username. How can I accomplish this with ASP.NET MVC routing system? I'm planning the follow URL layout: mysite/ -> home page mysite/account/register -> account register page mysite/user1 -> user1 home page mysite/user2 -> u...

ASP.NET MVC Routing not Working in Virtual Directory

I have an asp.net mvc 2 app (using .net 4.0) that isn't routing correctly when hosted in a virtual directory. I have the following simple routing rule: routes.MapRoute( "Default", // Route name "{action}", // URL with parameters new { controller = "accounts" } // Parameter defaults ); ...

How to achieve a dynamic controller and action method in ASP.NET MVC?

In Asp.net MVC the url structure goes like http://mysite.com/{controller}/{action}/{id} For each "controller", say http://mysite.com/blog, there is a BlogController. But my {controller} portion of the url is not decided pre-hand, but it is dynamically determined at run time, how do I create a "dynamic controller" that maps anything t...

ASP.NET MVC 2 routing on IIS 7 - can only view homepage on previously working website, what can I try to fix it?

Am pulling my hair out over this! I have an ASP.NET MVC 2 web application, which up until yesterday was working fine on the hosted server (running IIS 7.5, I don't have direct access to IIS, just web portal access to some features). Yesterday I attempted to install the ELMAH logging framework (see this article) and now all my routes ap...

restrict the user from jumping controller and action methods

Folks: My ASP.NET MVC 1.0 application is more like a workflow. Means: Parent controller's action method (authentication) --> Child 1 Action method --> Child 2 Action method --> Child n Action Now once the visitor completes the Authentication through the parent controller's action method he can manupulate the URL and jump directly to t...

Advanced ASP.NET MVC routing scenario

Hello, I have an ASP.NET MVC app with the following deployment requirements: The URL structure must be something like: http://server/app/[enterprise]/[communinty]/{controller}/{action}/... What I think I want to be able to do is intercept the URL before the MVC route handler gets its hands on it, remove the [enterprise]/[community] p...

MVC 2 routes appearing as parameters.

Hi there I am trying to build a route with the format of {controller}{action}{classificationID}{reviewID}{CategoryID}\ but I want to be able to address it without the final CategoryID and have that default to 1 where it isn't given. Here are my routes: routes.MapRoute( "Default", // Route name "{contr...

Wildcards with ASP.NET MVC MapPageRoute to support organizing legacy code

I'm working on migrating an existing ASP.NET web site into an MVC project. There are several (60+) pages that I don't want to rewrite just yet, and so I'm wondering if there's a way that I can: Move the existing .aspx pages (both markup and code-behind files) into a 'Legacy' folder in my MVC structure Set up routing so a call to /foo....

I wish to have a route named 'properties', but receive 404 error (Detects folder exists on disk)

Hey guys, I will try and be brief, I am finding when trying to create a custom route with a name and url of properties that my ASP.NET MVC app is returning a 404 file not found when hitting the route. I have deduced this down to most likely be caused by the fact I have a folder on disk called Properties which is of course a common asp....

Content-Aware Route Mapping in ASP.NET MVC 2

I am working with ASP.NET MVC 2 and would like to optimize my routing. The desired result is as follows: http://www.url.com/Sites/ http://www.url.com/Sites/Search/NY001 http://www.url.com/Sites/NY001 http://www.url.com/Sites/NY001/Photos The problem with this scenario is that I want to treat the URL bits differently depending on their...

asp.net mvc 2 global.asax.cs being ignored

I was having trouble debugging why a route was throwing a 404 when I was positive I set it up correctly. I made changes, rebuilt, still 404, I did all kinds of crazy stuff to the route but always 404. then in my frustration I just deleted ALL the routing in global.asax, saved rebuilt and ran. I still got 404... but the rest of the site...

MVC Handler for an unknown number of optional parameters.

I am workingon an MVC route that will take an unknown number of parameters on the end of the URL. Something like this: domain.com/category/keyword1/keyword2/.../keywordN Those keywords are values for filters we have to match. The only approach I can think of so far is UGLY... just make an ActionResult that has more parameters than I ...