routes

Routing in ASP.NET MVC 2.0

自闭症网瘾萝莉.ら 提交于 2019-12-10 10:06:10
问题 I'm looking to make a really simple route in my ASP.NET MVC 2.0 website. I've been googling for help but all the examples I can find are for really complex routing. Basically I want all the pages in my Home Controller to resolve after the domain as opposed to /Home/ For example I want http://www.MyWebsite.com/Home/LandingPage/ To become http://www.MyWebsite.com/LandingPage/ But only for the Home controller, I want the rest of my controllers to function as normal. I thought about creating a

File to define route in MVC3

十年热恋 提交于 2019-12-10 09:43:49
问题 I have this file : <fru> <url action="product" controler="Home" params="{id=123}" >this_is_the_an_arbitrary_url_of_a_product.html</url> <url action="customer" controler="Home" params="{id=445}" >this_is_the_an_arbitrary_url_of_a_customer.html</url> ... other urls ... </fru> I'm looking for binding this file or this object structure with the MVCHandler, in order to map the request to the good action with the params. It's important for the url me that the urls doesn't respect any structure

Using a regex to match a substring in a Laravel route

假装没事ソ 提交于 2019-12-10 07:33:42
问题 My URL is: www.foo.com/some-bar-slug-here/page I can't get a route to catch if the string "bar" is found in the slug shown above: Route::any('{myslug}/page/', array('as'=>'bar-page', 'uses'=>'Controllers\MyBar@index')) ->where('myslug','/bar/'); If I use the regex expression [0-9A-Za-z\-]+ it works, but it doesn't work for /bar/ . Any ideas? 回答1: I got it working with ^([0-9A-Za-z\-]+)?bar([0-9A-Za-z\-]+)? So the updated route code looks like this: Route::any('{myslug}/page/', array('as'=>

Get array of one url param

纵饮孤独 提交于 2019-12-10 03:50:01
问题 I want get the url-param ids, but It will not work. Is here everyone who can help me? The following code doesn't work. Url: http://localhost:9000/rest/alerts?ids[]=123?ids[]=456 Routes.conf GET /restws/alerts{ids} controllers.AlertService.findAlertsForIds(ids: List[String]) AlertService.java public static Result findAlertsForIds(List<String> ids){ return ok("Coole Sache"); } 回答1: Try passing ids as string like this http://<hostname>:9000/rest/alerts?ids=123,456,789 and then get the array by

Is there default catch all route to new actions in Play 2?

老子叫甜甜 提交于 2019-12-10 02:21:17
问题 In Play 1, new actions you defined had a default route. * /{controller}/{action} {controller}.{action} (This appeared by default in new projects) What is the Play 2/2.1 equivalent? Why doesn't it appear in the default routes file? 回答1: Actually there is a catch-all route available. According to the routing doc in Play 2.0+ you can use Dynamic parts spanning several / so if you put it as exactly last route of given method it will catch every route that wasn't catch before. You can use this for

Should I use RouteParameter or UrlParameter for an Asp.NET web-api route?

混江龙づ霸主 提交于 2019-12-10 01:52:32
问题 I've seen both being used and so I wonder, do they do the same thing or different things? If it's the latter, what's the difference? I tried answering it myself by having a look at the visual studio MVC 4 (rc) web api template, but sadly it uses both, so my confusion remains. Here's what the template contains: public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapHttpRoute( name: "DefaultApi",

How do you route [OPTIONS] in Rails?

自作多情 提交于 2019-12-10 01:28:47
问题 I am making a REST service in Rails. Here are my routes. resources :users match '/users', :controller => 'users', :action => 'options', :constraints => {:method => 'OPTIONS'} I am able to [GET] my users. I am trying to update my users and I get an error: ActionController::RoutingError (No route matches [OPTIONS] "/users/1"): When I run rake routes here are the routes that I am given: users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format)

How do I do a redirection in routes.rb passing on the query string

心不动则不痛 提交于 2019-12-10 01:02:31
问题 I had a functioning redirect in my routes.rb like so; match "/invoices" => redirect("/dashboard") I now want to add a query string to this so that, e.g., /invoices?show=overdue will be redirected to /dashboard?show=overdue I've tried several things. The closest I have got is; match "/invoices?:string" => redirect("/dashboard?%{string}") which gives me the correct output but with the original URL still displayed in the browser. I'm sure I'm missing something pretty simple, but I can't see what

Rails Routing Broken In Production - Caching of routes.rb suspected

和自甴很熟 提交于 2019-12-10 00:58:48
问题 Update: Turns out that this problem was because half my mongrel did not restart. Thanks all for help! Hi folks, i have an urgent problem. Essentially, my routing works on my localhost. But when i deployed this to production, the routes does not seem to work correctly. For example, given a new route "/invites" - sometimes i will get a 404, and sometimes it will work correctly. I suspect there is some caching going on somewhere, but i am not sure. Logs: when a page is not found (when the routes

No route matches {:action=>“edit”, :controller=>“events”} missing required keys: [:id]

眉间皱痕 提交于 2019-12-09 23:57:58
问题 i'm working on a Rails app and after trying to add a "Edit Event" link, I've been getting the following error. No route matches {:action=>"edit", :controller=>"events"} missing required keys: [:id] Down below is my index.html.haml .event_con %h1 Things you've done - @events_own.each do |event| .event_title = event.activity .event_rating %strong Rating : = event.rating &#47 10 .event_when %strong Started : = event.time.to_s(:short) .event_end %strong Ended : = event.timetwo.to_s(:short) .event