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...
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...
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...
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.
...
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 ...
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...
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...
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...
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 => "...
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 ...
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...
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 ...
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?
...
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 => ...
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...
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 = (...
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...
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
...
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:
...
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/';
...