routing

Is it possible to pass classes between controllers in ASP.NET MVC?

Is it possible to do something like this in an ASP.NET MVC controller? public ActionResult Index(CustomADT adt) { ... } And you will pass in a class from another controller when you click on a link. Or is it only possible to pass around strings? Edit: A bit more elaboration. Let's say I have the following class hierarchy: publi...

ASP.NET MVC Routing for a Single Controller Site

I'm trying to create a simple site. Basically it has one Controller Home controller. This controller has an action Index takes a string as argument (which is a directory) and uses that 'directory' to do its work. I can't work out how to create a generic catch all route that will send every URL to this one Action. Any URL combination c...

Why is MvcApplication.RegisterRoutes defined as static?

I know this could be silly, but would like gurus to clarify it for me... Why is this method defined as static .. public class MvcApplication : System.Web.HttpApplication { /* Why this method is declared as static? */ public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*path...

Feed name URL in ASP.NET MVC.

I'm writing a simple news site. I want that the URL will be something like this: http://domain.com/killing-puts-focus-on-crimes-against-latinos ...instead of the basic Controller-View-ID structure. I do not want something like: http://domain.com/news/killing-puts-focus-on-crimes-against-latinos How can I do this? Thanks. ...

ASP.NET MVC routing issue?

I keep getting errors like this after my pages are done refreshing. The controller for path '/S43G/S4_Manager/WebResource.axd' could not be found or it does not implement IController. but I get the error for any file that does not exist on my hard drive. regardless of extension (.png, .css, etc) I've tried all of the following to fix ...

Repeating a Parameter in a ASP.NET MVC Route

I am trying to write a route that matches the following URL format: /category1/category2/S/ where the number of categories is unknown, so there could be 1 category or there could be 10 (1..N). I cannot use a catch all becuase the categories are not at the end of the URL. I am actually routing to a web form here (using Phil Haack's ex...

Routing Classic ASP Requests To .NET - SEO Redirects

We are replacing an old classic asp website with a .NET 3.5 solution. We need to redirect all of the classic ASP requests to aspx pages (i.e. contactus.asp, may now route to /contact-us/default.aspx). What I woudl like is for the requests to hit global.asax so I can do something like If url == "bob.asp" Response.Status = "301 Mov...

ASP.NET MVC routing issues

I'm having some issues trying to setup my Routing in MVC. I think I understand how it works, but I just can't seem to set the proper paths. Basically I want to do something similar to how StackOverflow works so: http://localhost/faq I want this to grab the HomeController, hit the faq action and return the faq view. I can't seem to f...

How do I get a custom action to go to the right place?

I'm new to Ruby on Rails, and I'm sure I'm just missing something simple and stupid, but I can't figure out how to get my 'account/signup' action working. This is what I have in my routs file: map.connect ':controller/:action' map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' map.root :controller => "...

Asp.Net MVC Routing - how do I match the whole URL?

I'm trying to create a catch-all route to track when an affiliate string is in the URL. An affilite code is marked by an x followed by an int, and will only appear at the end of a URL (but before the query string). The idea is that I will extract the affiliate ID, do some logging, then do a 301 to the same request without the affiliate ...

ASP.NET MVC routing and areas

I am messing around with ASP.NET MVC 2 Preview 2 and am trying to figure out how routing works with areas and such. In a single project implementation of areas, I want an area named "admin". I am trying to be able to have urls like this: (root)/admin/apples/search (root)/admin/apples/edit/3 (root)/admin/apples/add (root)/admin/oranges...

ASP.NET MVC - Verify the Existence of a Route

My ASP.NET MVC application has a scenario where user input can directly influence the target of a call to RedirectToAction() (by way of a string) and there is a chance that the user could create a run-time error if improper input leads them to request an action that does not exist. I'd like to prevent this problem outright, but I'd like ...

.NET MVC custom routing

I was wondering if I could create a routing map with one more higher level than the controller. The typical routing would include "/controller/action/id". What I am looking for is something like "section/controller/action/id" or "controller/section/action/id". How can i do this? ...

Command to use inside the controller's action logic to determine the route that caused that action to be invoked?

I used rake routes to print out all of the routes in my application. What I found is that a couple of routes map to the same controller/action combination. So in my action I would like to display which route was actually used to track down where everthing is coming from. I tried just rendering params.inspect as text: render :text => ...

Context, Membership, Etc Null when using MVC on IIS7

I'm sure this must be something simple that I'm missing. I'm using MVC Routing in my Forms applicaiton for Url Routing. On most of the forms I access the Context, Membership, etc. On my dev machine and on IIS6 everything works fine. I'm just trying to get to work on IIS7 and no luck. The Routing works as it should, but anytime I try...

.NET MVC custom routing with empty parameters

Hi All, I have a .net mvc with the following routes: routes.Add(new Route( "Lookups/{searchtype}/{inputtype}/{firstname}/{middlename}/{lastname}/{city}/{state}/{address}", new RouteValueDictionary( new { controller = "Lookups", action = "Search", firstname = (string)null, middlename = (string)null, lastname = (...

help with rails render action vs routing

I was using some image cropping example that I found online and now I got confused. There is actually no "crop" method in my controller. Instead (following the guide) I put a render :action => 'cropping', :layout=> "admin" In my create method. That renders a page the view called cropping.html.erb . It works fine but I have no idea h...

creating a route for my search param

I'm aware of dynamic routes but I'm a little stumped with this, with the search gem I'm using it performs a get and my route is thus myapp.local/recipes?search=chicken How can I make this a route? so that it would stay in the recipes controller but appear to the user like a nested route, like this myapp.local/search/chicken ...

ASP.NET MVC - Shortening urls

I am developing an international web site - multiple countries, multiple languages. I am trying to create SEO friendly URLs. For example the catalog consists of cartesian product Regions x Categories. A typical catalog url has 7 levels of hierarchy: www.site.com/en/Catalog/Browse/10/28/London/Category1 The route format is as follows: ...

Rails & jQuery - getting UnknownAction error when checking username availability

Hi - I'm trying to write a small jQuery method that works on my rails site and check if a username is available. This is all handled in the users_controller.rb and on the form: <script> $( function() { $('input#username').keyup( function() { var username = $('input#username').val(); url = '/users/check_username/'; ...