asp.net-mvc-routing

ASp.NET MVC 1.0 map route to subdirectory

How to I setup a route of the url /customer/export/billing to the controller Customer.ExportBilling() ? When I try this: routes.MapRoute( "exportCustomerBilling", "customer/export/billing", new { controller = "Customer", action = "ExportBilling" }); I get a 404, the controller method is not invoked. Using <%= Htm...

Does ASP.NET MVC have any DateTime route constraints?

Hi folks, does ASP.NET MVC contain any route contraints baked into the code? if so, how do i define a date-time constraint? eg. url: http://mydomain.com/{versionDate}/{controller}/{action} http://mydomain.com/2010-01-20/search/posts cheers :) ...

Show breadcrumbs when Passing GUID

Hi, I'm working with ASP MVC 2 RC2 and using the standard sitemap provider. I'd like to show breadcrumbs on a page which passes a guid in the url e.g. /validate/GUID but i'd like the system to ignore the GUID and just show the (Home > Validated) for the page, as I don't want to dynamically re-create the sitemap each time I create a n...

Change culture in MVC

Hi, I'm using URL based localization logic in my MVC app. so, default route would be mysite/someControler, and localized route would be mysite/en-US/someControler. "en-US" is value for "culture" parameter which has default value. I'm wondering what is there any generic way to switch between cultures, and keep all the url route values...

Virtual Directory App within a Asp.net MVC app

I am having issues trying to host screwturn wiki as a virtual directory application within my current domain. the domain is hosted as something.com and the wiki would look like something.com/wiki when i browse to something.com/wiki I get Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, Public...

ASP.NET MVC Ajax.beginform sporadically not calling action method

I am using Ajax within MVC to render some partial views and have come across a weird problem. Once I click a tab which submits ajax.beginform to render the tab as a partial view, the following happens: from the ajaxOptions, the OnBegin function is called. after this it is supposed to go to the function inside the controller which is s...

ASP.Net MVC + Wordpress

Hello, I have ASP.Net MVC project. Plus wordpress blog under a subfolder "/Blog". Now, when I access the URL www.domainname.com/Blog, I get the following error: "The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map....

Need help with error using MvcContrib.TestHelper's ShouldMapTo() generic extension method

I'm trying to unit test my routes using the MvcContrib.TestHelper ShouldMapTo<TController>() extension method, but my tests fail with the following error message: failed: Method MvcContrib.TestHelper.RouteTestingExtensions.ShouldMapTo: type argument 'ReviewController' violates the constraint of type parameter 'TController'. But Review...

ASP.NET MVC 2.0.... generate query URL parameters from Model?

Hello, I have an ASP.NET MVC application that has one part where I dont really want to use the auto url feature. I have a significant number of OPTIONAL parameters that need to pass in. This is basically for a complex query form... and a parameter that is not in use (i.e. has the default value) should please not be part of the URL. I lo...

Considerations when turning on RouteExistingFiles

I am looking to generate some CSS files dynamically in my Content folder. At the moment, this folder has an ignore route (routes.IgnoreRoute("Content/{*wildcard}");) and, I'd like that to remain, as I don't need/want most of my content folders to go into the MVC request lifecycle. Example: routes.MapRoute( "DynamicCSS", "Content/...

ASP.NET MVC: Proper way to consume/link to a resource from another controller

In a view, I want to consume some Json produced by an action on another controller. I don't think I ought to be arbitrarily specifing the url for the resource because if I say something like "/Dealerships/GetDealerData" and if my application is a virtual directory at say "www.somesite.com/MyApplication", then my reference to that resourc...

ASP.MVC routes without Details action

I'd like to have URLs that are even shorter than /{Controller}/{Action}/{Id}. For example, I'd like {Controller}/{Id}, where {Id} is a string. This would allow for simple paths, e.g. Users/Username, Pages/Pagename, News/Newsname. I like this better than requiring the /Details action in the URL (Users/Details/Username), which is less e...

How can I create a route constraint of type System.Guid?

Can anyone point me in the right direction on how to map a route which requires two guids? ie. http://blah.com/somecontroller/someaction/{firstGuid}/{secondGuid} where both firstGuid and secondGuid are not optional and must be of type system.Guid? Thanks ...

Generate ActionLink/RouteLink from Paging UserControl that uses the current routevalues and modelstate

I'm implementing a site which has a search that can be executed via Controller methods that are accessed from two different routes. One hangs off the default route (using either Post data or query string values for the search parameters) and one is an SEO optimisation url which takes a location and phrase via two route values. The seco...

How to handle null {id} on route?

What if a user hits my site with http://www.mysite.com/Quote/Edit rather than http://www.mysite.com/Quote/Edit/1000 In other words, they do not specify a value for {id}. If they do not, I want to display a nice "Not Found" page, since they did not give an ID. I currentl handle this by accepting a nullable int as the parameter in the Con...

Server Error in '/' Application. - The resource cannot be Found.

I am new to ASP.NET MVC 2. I do not understand why I am receiving this error. Is there something missing that i'm not referencing correctly. I'm trying to create a simple jquery autocomplete online search textbox and view the details of the person that i select using System; using System.Collections.Generic; using System.Linq; using...

How do you link to an action that takes an array as a parameter (RedirectToAction and/or ActionLink)?

I have an action defined like so: public ActionResult Foo(int[] bar) { ... } Url's like this will work as expected: .../Controller/Foo?bar=1&bar=3&bar=5 I have another action that does some work and then redirects to the Foo action above for some computed values of bar. Is there a simple way of specifying the route values with Red...

How test that ASP.NET MVC route redirects to other site?

Due to a prinitng error in some promotional material I have a site that is receiving a lot of requests which should be for one site arriving at another. i.e. The valid sites are http://site1.com/abc & http://site2.com/def but people are being told to go to http://site1.com/def. I have control over site1 but not site2. site1 contains ...

ASP.NET MVC hosting problem, routing, handlers and modules

Hi, This is one of them again, hosting with fasthosts. I recently purchased a windows developer package from them. When I tried to deploy my ASP.NET 3.5 MVC project, which was working fine with the same host on a reseller account, it is not working. The reason to move from reseller to a normal Windows Developer package is, the MS-SQL...

Action not found in Route table?

Hi, Just started my first MVC 2.0 .net application. And I set up some default pages like: /Loa/Register /Loa/About But when I request for /Loa/sdfqsdf (random string) I get the "The resource cannot be found." error, how can I redirect this non-existing action to a default action? Like an "action not found" default action? thx! ...