asp.net-mvc-routing

Asp.Net MVC Virtual Area

Is there such a thing? I have two projects within the same solution. When I run the solution within Visual Studio two separate instances of localhost are launched. project foo is available at http://localhost:3091 and project bar is available at http://localhost:3094 I would like to have access to project bar within foo for example...

Why is the wrong controller being called when I start my ASP.NET MVC2 application?

I have a controller called MetricsController with a single action method: public class MetricsController { public ActionResult GetMetrics(int id, string period) { return View("Metrics"); } } I want to route calls to this controller like this: http://mysite/metrics/getmetrics/123/24h I've mapped an additional route in my Gl...

How can we Route something like {calendar}/{controller}/{action}/{id}

As a beginner in MVC I'm trying to figure out what's the best way to accomplish a route for my needs, and I'm getting no luck at all, so I'm kindly ask for any help My webApp is driven by Calendars, and per each Calendar there are a bunch of actions Subscribe Edit Calendar View Winners Daily Challenge etc... and I would like to avoi...

MVC using Action Filter to check for parameters in URL. stop action from executing

I want to make the following: when the url doesn't have an instID, i want to redirect to the "Instelling" action in this controller, every method needs the instID. [RequiredParameter(parameterName="instID", controllerToSend="Instelling")] public ActionResult Index(int? instID) { //if (!instID.HasValue) { ...

Can't bind to parameter

I've got the default routing: routes.MapRoute( "Shortie", // Route name "{controller}/{id}", // URL with parameters new { controller = "Ettan", action = "Index", id = "id" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{...

Why can't I get the MvcHttpHandler to handle my .mvc requests?

I have a project using Asp.Net 3.5 and MVC 1. Everything runs perfectly on my local IIS, but not after I deployed it to the hosted server. The web server is IIS7 with integrated pipeline activated (according to the hosting company). When I go to the root of the web site, www.site.com, the default.aspx makes a redirect to a controller ...

MVC Routing Help Required

I'm trying to map the following routes in MVC2. [absoluteUrl] [absoluteUrl]/[dynamicBlogName] These two routes should map to the same controller/actionresult. e.g PostController/Index I also need to map these routes. [absoluteUrl]/post/[dynamicPostName] [absoluteUrl]/[dynamicBlogName]/post/[dynamicPostName] These two routes sh...

How to route to another controller?

OK I have two different controllers, say controllerA and controllerB, Now from within controllerA I have to redirect with some parameters to controllerB and inside controllerA i wrote RedirectToAction("ControllerBAction", new { keywords = text }); How do I define the routes in global.asax.cs? I am a newbie to MVC. Thanks for all the...

How do I prevent the `Index` action appearing in my ASP.NET MVC2 urls?

I have a route that looks like this (but I've tried a few different ones): routes.MapRoute( "Metrics", "Metrics/{action}/{id}/{resource}/{period}", new { controller = "Metrics" } ); On the MetricsController I have the following actions: // Index sets up our UI public ActionResult Index(int id, string resource, string period) /...

ASP.NET MVC2 Route Mapping ignore action and id

I'm trying to add a FAQ section to a website that I'm working on and I want to ignore any action or id that is added to the URL. The RegisterRoutes method of the Global.asax.cs file has been changed to; public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( ...

ASP.NET Mvc - nullable parameters and comma as separator

Hello. How should I define route in my global.asax to be able use nullable parameters and coma as separator? I'm trying to implement routing rule for my search users page like "{Controller}/{Action},{name},{page},{status}" Full entry from the Global.asax: routes.MapRoute( "Search", "{controller}/{action},{name},...

Is it possible to localize a URL / routing in ASP.NET MVC?

I'm working with a client that wants the URLs in our web application to be in French. I'm an English developer and we also have English clients. This is an interesting problem but I don't think its something the ASP.NET MVC Framework would support. Here's the scenario. The route... Specific EXAMPLE English URL www.stackoverflow.com/...

MVC 2.0 - different view based on URL with shared controls

I have 2 master pages. One is intended to be shown in a normal standalone website. The other is to be used in external sites as an Iframe. I want to be able to show the normal page at http://example.com/home/index and the iframed version at http://example.com/framed/home/index I want to have controls that will postback to one control...

MVC application deployed to IIS5 using Wildcard mapping causes 401 and 404 errors on CSS and JS

I've been developing an MVC 2 application under the built in Web-server in VS2010. On Friday, I moved it to a virtual directory under IIS 5 in my WinXP development machine. I had the usual problems, and added a wildcard mapping to the Virtual Directory configuration in IIS to map .* to aspnet_isapi.dll (Framework 4). Neither the check ...

MVC 2 - How to set the namespace targeted by an actionlink

I have 2 namespaces for my controllers. One is the default MyProject.Controllers and the second is MyProject.Controllers.Framed. I am using namespaces so that I can have a url like /home/index serve up the normal home website and /framed/home/index serves up a version intended for use in an iframe. My problem is that when I put <%: Ht...

MVC 2 route from form GET? Or POST?

Hi All, I have a small form with a single textbox and a submit button. using (Html.BeginForm("Index", "Tag", FormMethod.Post) In my tag controller i have a method that looks like: public ActionResult Index(string tagText) I'm trying to figure out first how to route this so the resulting URL will look like: http://mydomain.com/Tag...

How to MapRoute? If http://abc.com/Home go to Home Controller else go to Misc Controller.

I have three controllers, Home, Blog and Misc. When I type mydomain.com/Home at the address bar, the browser displays the view for the home controller. When I type mydomain.com/Blog at the address bar, the browser displays the view for blog controller. And when I type mydomain.com/anything (not Home nor Blog) the browser displays the ...

Why does RedirectToRoute("Default") not redirect to the root?

Given these routes: routes.MapRoute("Test", "test", new { controller = "Test", action = "Index" }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); If I call RedirectToRoute("Default") from the Index action of the TestController it redirects to /t...

Discover which (if any) route will match a given URL from within Controller in ASP.NET MVC2 app

In my master page I have a placeholder where a Html.RenderPartial() will render a collection of (bread)crumbs which are effectively a list of links I build up using action, controller names and RouteValueDictionary's. I have an action that is called from multiple places to view a short-list and so when building the list of breadcrumbs f...

MVC HttpUtility.UrlEncode

Hi All, i am attempting to use HttpUtility.UrlEncode to encode strings that ultimately are used in URLs. example /string/http://www.google.com or /string/my test string where http://www.google.com is a parameter passed to a controller. I have tried UrlEncode but it doesn't seem to work quite right my route looks like: routes.Map...