asp.net-mvc-routing

Invalid ASP.NET MVC route should go to custom 404 page instead of Forms Authentication's login page before login

Is it possible to configure ASP.NET MVC 2 RC and FormsAuthentication to achieve the following? The below scenarios need to be played out before a user logs-in to the system. Scenario 1 - The user navigates to "http://server/home/invalid-action". A custom 404 error page is displayed. Scenario 2 - The user navigates to "http://server/inv...

auto add route parameter to url

i have 2 urls on one page: http://host/home/list and http://host/home/list/1. if i click on second url then first url renders with param 1, so url1 equals ulr2 (url1 = http://host/home/list/1 and url2=http://host/home/list/1) i use such code <%= Html.ActionLink("link", "DesignerFiles", "Home", null, null)%> url1 <%= Html.ActionLink(...

Avoiding the Controller with Routing Rules in ASP.NET MVC

I've created a website with ASP.NET MVC. I have a number of static pages that I am currently serving through a single controller called Home. This creates some rather ugly URLs. example.com/Home/About example.com/Home/ContactUs example.com/Home/Features You get the idea. I'd rather not have to create a controller for each one of the...

MVC2 Routing Issue

I have a few routing issues with my ASP.NET MVC2 website and was wondering if there is a way I can get the runtime to simple list of all of the routes it thinks it understands. Some thing like the fubu diagnostics would be handy ... ...

ASP.NET MVC 2 RC2 Routing - How to clear low-level values when using ActionLink to refer to a higher level?

[NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My routing table lists the most-specific routes first, so I've got: // customers/123/orders/456/items/789/edit routes.MapRoute( "item", // Route name "customers/{customerId}/orders...

Syntax to specify Namespace when using helper.RouteUrl

I am using Asp.Net MVC 2 - RC w/ Areas. I am receiving an ambigious controller name exception due to having same controller name in two different areas. I've read Phil Haack's post Ambiguous Controller Names With Areas I can't figure out the syntax when trying to use UrlHelper (I have an extensions class). e.g. public static string ...

Site Security/Access management for asp.net mvc application

I am trying to find a good pattern to use for user access validation. Basically on a webforms application I had a framework which used user roles to define access, ie, users were assigned into roles, and "pages" were granted access to a page. I had a table in the database with all the pages listed in it. Pages could have child pages t...

ASP.NET MVC: routing help

Consider two methods on the controller CustomerController.cs: //URL to be http://mysite/Customer/ public ActionResult Index() { return View("ListCustomers"); } //URL to be http://mysite/Customer/8 public ActionResult View(int id) { return View("ViewCustomer"); } How would you setup your routes to accommodate this requiremen...

controller path not found for static images? asp.net mvc routing issue?

I have an image folder stored at ~/Content/Images/ I am loading these images via <img src="/Content/Images/Image.png" /> Recently, the images aren't loading and I am getting the following errors in my error log. What's weird is that some images load fine, while others do not load. Anyone have any idea what is wrong with my routes...

NerdDinner routing

I watched Scot hanselmann's presentation at mix '10. When he presented the tiny urls for Nerddinner he said it was a 2 part process. a) modify global.asax.cs with a new route b)some sort of isapi rewrite. When I implemented this in my asp.net mvc 2 site I only did part a. and it works. why then did he do part b?? what is the advantag...

Need Help Creating a Route in ASP.NET MVC

I want to create a route like //Widgets/PerformanceTable/['best' or 'worst' to sort by performance of an investment] where either 'best' or 'worst' are required. Can somebody show me a good way to do this? Thanks ...

When to use a routing rule vs query string parameters with asp.net mvc

We're considering moving forward with a ASP.NET MVC project and the subject of routing versus parameters came up. Seeing as how you can easily set up either or a combination of both in ASP.NET MVC, are there any considerations that I should be aware of when using one or the other? ...

Legacy URL rewriting with query string parameters

I've looked at http://stackoverflow.com/questions/817325/asp-net-mvc-routing-legacy-urls-passing-querystring-ids-to-controller-actions and several other similar posts for legacy URL routing, but I can't get past the error "The RouteData must contain an item named 'controller' with a non-empty string value." Looking this up on line didn't...

ASP.NET MVC Routing - Redirect to aspx?

This seems like it should be easy, but for some reason I'm having no luck. I'm migrating an existing WebForms app to MVC, so I need to keep the root of the site pointing to my existing aspx pages for now and only apply routing to named routes. Here's what I have: public static void RegisterRoutes(RouteCollection routes) { ...

Find the Method that will be executed in the controller using reflection

I'm maintaining an ASP.NET MVC site where they are doing their own security. So they have created a class derived from AuthorizeAttribute. In the OnAuthorization, they have some reflection code that finds the method based on the action name in RouteData. The problem that I see, is that if you have multiple action functions in the co...

How to run a WebForms page and an MVC page in different files?

when i try to do this and load the webforms page, i get this error, even tho the path is correct. what can i do to get past this? i've tried running the aspx page from the root as well. nada. Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependenci...

Controller Action Methods with different signatures

I am trying to get my URLs in files/id format. I am guessing I should have two Index methods in my controller, one with a parameter and one with not. But I get this error message in browser below. Anyway here is my controller methods: public ActionResult Index() { return Content("Index "); } // ...

ASP.NET MVC, areas, routing and a controller factory.

Hi, I've an interesting problem with some routing with an ASP.NET MVC app. I'm building a CMS and I've got a catch-all handler that takes the URL and checks to see if there's some matching content in a database. If so, it displays it, otherwise we get a 404. Now I've got all that working with some test data, I moved on to write a quick...

What ASP.NET MVC Route controls the appearance of hashes in URIs?

I have integrated a Silverlight Navigation Application in an ASP.NET MVC web. However when Silverlight calls for its default page, say, IndexPage ASP.NET MVC displays the route as: http://localhost/#/IndexPage I have tried to get ASP.NET MVC to respond to this route: http://localhost/#IndexPage but I am unable to find a configurati...

Dynamic 'twitter style' urls with ASP.NET

I am looking to produce an MVC site which has complete control of the url structure using routing. The specific requirements are: www.mysite.com/ = homepage (home controller) www.mysite.com/common/about = content page (common controller) www.mysite.com/common/contact = content page (common controller) www.mysite.com/john = twitter s...