routing

Vanity MVC Routes?

I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the company names need to map to the same "base" controllers, regardles of what the name is. I only need the companyName for authentication purposes. Also, if there's no companyName provided, I need to map to a different set of co...

How to show a custom 404 page in ASP.NET-MVC?

When any URL is 404 on my site, i want to show a custom 404 page that is rendered with ASP.NET-MVC. Hoewever i do not want to use the wildcard route approach because that would disable standard webforms. My code currently looks like this: if (serverException is HttpException && ((HttpException)serverException).GetHttpCode() == 404) { /...

Rails routing error doesn't recognize id

I have a controller "manage_links.rb" that allows users to manage their links, which have a corresponding "link" model. I am getting the following error: ActionController::RoutingError in Manage_links#index Showing app/views/manage_links/index.html.erb where line #16 raised: edit_manage_link_url failed to generate from {:controller=>...

.Net MVC: Bind route value to a session value

Hi I want to do the following: The user should have his own sub site on my web site. Therefor I've added a new route: routes.MapRoute( "ShopEntered", "{username}/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); When the site gets called for the first time I want to store the username...

How to limit the resource formats in the Rails routes file

When routing resources in Rails the optional format attribute is automatically appended to the generated routes. This is so that the resource in question can be requested as either XML, HTML etc. Which formats that is actually allowed is usually described in the controller using respond_to. But in many cases you only want to support HTM...

Language dependent routes in ASP.NET MVC

Has anyone had any experienced with making language dependent routes with ASP.NET MVC? What I would like to do is have localized url's to improve SEO. So for example http://mysite.com/products/cars would map to the same controller/action as http://mysite.com/produkter/bilar? I have tried browsing around a bit, but I could not find anyth...

Is there a way in ASP.NET MVC to handle different Response.StatusCode values?

By default, the MVC Authorize attribute sets the HttpContext.Response.StatusCode = 401 when a user is not authorized and the section in the web.config routes to the loginUrl property. I want to do something similar with other response codes. For example, I have an attribute called ActiveAccount which verifies the user's account is cur...

Help with route rewrite in asp.net mvc

Im having a really hard time understanding routing. Please help me with this problem. Each of my controllers have these three actions right now Users have Index, Create and Edit Locations have Index, Create and Edit Companies have Index, Create and Edit The thing is, it all gets done through ajax. I have jquery ui tabs with two t...

Refactoring my route to be more dynamic

Currently my URL structure is like this: www.example.com/honda/ www.example.com/honda/add www.example.com/honda/29343 I have a controller named HondaController. Now I want to refactor this so I can support more car manufacturers. The database has a table that stores all the manufacturers that I want to support. How can I keep my URL ...

controller is not picking up the route

My route looks like: routes.Add(new Route("{companyName}/{action}/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller = "CompanyController", action = "Index", id = 1 }), } ); my action: public ActionResult Index(string companyName, string id) { Response.Write(companyNam...

Ruby on Rails Actions help

I have my index page which posts a single entry instead of the usual scaffold default of all of the entries. I told it to link to an action and it just responds to "Couldn't find Post with ID=all". It is the same as the default index method and index view. I assume this has something to do with routing but being no I have no clue. Any id...

Asp.Net MVC routing diffrence in www.Mysite.com/Employee and www.Mysite.com/Employee/ while using JqGrid

I am using ASP.NEt MVC for one of my project. In this I have Employee controller which can be called by www.Mysite.com/Employee/ url. Also I have used JqGrid which uses followng to fetch data url: "GetGridData" While testing the same I found that If i type www.Mysite.com/Employee/ in browser a call is made to www.Mysite.co...

Is it possible to run an ASP.NET project and an ASP.NET MVC project side-by-site on the same website?

I have an existing ASP.NET website with some custom routing, within a Solution that also contains Business Logic projects. I want to create a new project within the Solution, which is an ASP.NET MVC website. This website will also call the Business logic, and the ultimate aim is to port most of the code from ASP.NET to ASP.NET MVC. Bu...

How to define a custom path in rails?

I have a User model. If I do: def my_action @user = User.new end then <% form_for(@user) do |f| %> I get undefined method `users_path' for #<ActionView::Base:0x1b4b878> Which make sense because I haven't mapped it going map.resources :users... but I don't want to do it this way because I don't need all the resources. How ca...

asp.net routing in webform - how get route data

i put this in Global.asax.cs routes.MapWebFormRoute("Page", "Page/{*anything}", "~/Page.aspx", false); how i can get value of {*anything} in Page.aspx i'm using WebFormRouting from codeplex ...

Mass 301 redirects in ASP.NET, including pages that need to redirect to a different place depending on the query string parameters

We have several pages of our site indexed using old non-SEO friendly URLS such as http://www.domain.com/DocumentDetails.aspx?id=555. Recently we implemented routing that uses slugs stored in the database and looks up the slug to forward you to the right page using routing, for example: http://www.domain.com/Documents/Title-of-the-Documen...

ASP.NET MVC Routing

What would be the most appropriate route for this URL? www.mysite.com/searchkey0 www.mysite.com/searchkey1 Where searchkey is the keyword for a search method? I tried the following route: routes.MapRoute( _ "SearchRoute", _ "search", _ New With {.controller = "Search", .action = "Search", .id = ""} _ ) ...

controller sample code in php mvc framework and also support URL Routing

Please help me in coding for controller and support for URL Routing for PHP MVC framework. ...

Basic Rails 404 Error Page

I have been looking for a simple answer to this for a ridiculously long time and it seems like this has to be so plainly obvious and simple because no one has an easy, idiot proof tutorial. Anyway, all I want to do is to have a single 404.html static page that loads whenever ANY error is thrown. Ideally this should only happen in produ...

Rails: How to modify tests for a nested resource?

While learning Rails I've created an application with a Domains controller nested below a Customers controller. I'm using Rails 2.3.4 and it's been a learning experience. I managed to get the below routing set up: customer_domains GET /customers/:customer_id/domains(.:format) {:controller=>"domains", :action=>"index"} ...