asp.net-mvc-routing

Plus (+) in MVC Argument causes 404 on IIS 7.0

I have an MVC route that is giving me hell on a staging server running IIS. I am running Visual Studio 2010's development server locally. Here is a sample URL that actually works on my dev box: Root/CPUBoards/Full+Size Results Server Error404 - File or directory not found. The resource you are looking for might have been removed, had...

UrlHelper.Action doesn't map to the area that the controller is in correctly.

UPDATE 2 Ok - So it looks like my question is changing again slightly :-) I've realised now that UrlHelper.Action doesn't seem to correctly resolve the URL in any Area unless the area name is explicitly specified. If it's not specified it seems to return whatever area name we're currently in which makes it look like it's working from o...

UrlHelper's RouteUrl returning Empty String in Tests

I am having an issue where UrlHelper's RouteUrl method only returns an empty string when run in my tests, though function properly when executing in the real HttpContext. It is, however, finding the route - as I do properly get an exception if I try to resolve a route name which has not been defined. I have mocked the HttpContext and fr...

asp.net mvc routing question

the default routing works fine mysite.com/home/about and i even see how to customize it to make it shorter so i can say: mysite.com/edit/1 instead of mysite.com/home/edit/1 but how can i make it longer to handle url like the following mysite.com/admin/user/1 // works mysite.com/admin/user/details // does not work mysite.com/admin...

Question about ASP.NET MVC routing

Hello I have actions SomethingEditor, SomethingDelete, SomethingSave, SomethingAdd and i want set these routing: site/Something/Editor, site/Something/Delete, site/Something/Save etc How i can do it? ...

MVC2 - Route mapped but QueryString rendered

Hi there, in my Asp.net MVC2 app I have registered the following routes in the global.asax.cs: routes.MapRoute( "Search", "Search/{action}/{category}/{query}/{page}", new { controller = "Search", action = "Results", category = "All", page = 1 }, new { page = @"\d{1,8}" } ); // URL: /Search routes.MapRoute( "S...

routing webform in asp.net mvc

I have an ASP.NET MVC app and I have a WebForm page I built in the MVC due to a tutorial on how to do something I needed to do, but it was all in WebForm style. Ive tried to figure out how to do the same thing in MVC format but cant figure it out. So I was needing to figure out how to use this page in my MVC app. But when I try to go to ...

Best practices for building links in MVC

If I do not want to do this in my View Markup, <%=Html.RouteLink("Listings", "Listings", new {market = "Austin", state = "Texas", pagenumber = 3 })%> what would be the best approach to creating links in MVC 2? I have a HTML helper to build a custom link but all it is doing is acting as a wrapper around RouteLink (or ActionLink). ...

MVC2 without Routing

I have a case where MVC's routing (mapping a url to a controller) is just getting in the way. I want to circumvent it and send all urls to a single controller (no matter the format and without any attempt to parse them). I assumed this would be easy, but I'm stuck. Help is much appreciated. ...

Create URL That Matches Route From A Form

I have the following route: routes.MapRoute( "PlayerSearch", "Players/{playername}", new {controller = "Players", action = "Get"}); This works if I go to http://mydomain/players/playername. I also have a form that allows users to look up players by name: <% using (Html.BeginForm("Get", "Player...

pagination to asp page with model data.

hello all, I am receiving data on Browse.aspx page with the help of model now i want to add pagging to the table i am displaying ...code is... <%@ Page Title="Max 2.0" Language="C#" MasterPageFile="~/Views/Shared/Master.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<FMDomain.Models.User>>" %> <%@ Import Namespace="F...

MVC 2 customErrors works locally but not live?

Here is what I have in my web.config: <customErrors mode="On" defaultRedirect="/pages/sitemap"> <error statusCode="404" redirect="/pages/sitemap" /> </customErrors> Locally this works just as expected but live for some reason I still get the vanilla 404 error page? I am using MVC 2 with Areas, throughts? ...

What is the best way to do SO style routes (dashes as spaces)

Just wondering what the best way to do SO style routes is. http://stackoverflow.com/questions/3459559/what-is-the-best-way-to-do-so-style-routes-dashes-as-spaces What's the best way to create routes like this? ...

MVC Route not working

Update: As someone pointed out I was missing an s in my Route registration. Now I have a secondary problem. This is how I want it to work: http://localhost/products/ --> ProductsController.Index() http://localhost/products/3/apples --> ProductsController.Details(int? id, string productName) This is what currently happens: http:...

Routing is finding the controller in my areas, but not the views

I'm trying to use Maarten Balliauw's Domain Route class to map sub-domains to the areas in an MVC2 app so that I have URLs like: http://admin.mydomain.com/home/index instead of: http://mydomain.com/admin/home/index So far, I've only had partial success. Execution is being routed to the correct controller in the correct area, but it...

Best design pattern for associating subdomain with area and PRG pattern?

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature." Is there a easy/non tacky way of associating subdomains areas? Something like: http://a...

How to get RouteData by URL?

I need to get RoutData by given URL string in ASP.NET MVC application. I've found the way that I need to mock HttpContextBase based on my URL string and then pass it to RouteTable.Routes.GetRouteData() method in Route Parsing (Uri to Route) thread. How to mock HttpContextBase to retrieve RouteData by URL string using RouteTable.Routes....

Routing table is not working

HI I have the following routing table routes.MapRoute(null, "Save", // Route name new { controller = "Package", action = "Save"} // Parameter defaults ); routes.MapRoute( "Package", // Route name "{controller}/{action}/{name}/{p}", // URL with parameters new { controller = "Package", ac...

ASP.NET MVC multiple url's pointing to the same action

Hey there How do i map multiple url's to the same action in asp.net mvc I have: string url1 = "Help/Me"; string url2 = "Help/Me/Now"; string url3 = "Help/Polemus"; string url1 = "Help/Polemus/Tomorow"; In my global.asax.cs file i want to map all those url to the following action: public class PageController : Controller { [Http...

how to handle Asp.net MVC Routing along with asp.net webform routing

How to handle asp.net mvc routing along with asp.net webform routing. I have merged my mvc app into my existing web application. In my web application i have implement routing as below: routes.Add("View Product Details", new Route("Product/{City}/{Manufacturer}/{Name}/{ProductID}/{*ProductType}")); Similarly i have implemented rout...