routing

ASP.NET MVC routing and static data (ie. images, scripts, etc)

*爱你&永不变心* 提交于 2019-11-30 20:48:35
If I have a request for a resource in my ASP.NET MVC1 (or 2) web app for a static resource, say ... an image or a javascript file or a css file ... does the .NET framework try and see if the request matches the route list ... and eventually can't find a controller for it? eg. Resource: /Content/Images/Foo.png Does this request go through my route list .. fails to match any controllers / actions to this request and then attempt that path directly? Svetlozar Angelov You can choose whether to map an existing file or not setting the RouteCollection.RouteExistingFiles Property Gets or sets a value

Routing, an unlimited number of parameters

大兔子大兔子 提交于 2019-11-30 20:34:25
For example, link: /shop/phones/brend/apple/display/retina/color/red where: phones - category alias brend - name of attribute; apple - attribute value display - name of attribute; retina - attribute value color - name of attribute; red - attribute value Attributes can be any number. Order may also be different. The beginning of the route is clear: /shop/{category} And what to do next is unclear. In symfony 1, a set at the end star ("/shop/:category/*") and all that was not clearly marked, and come in a pair of name -> value Question: how to describe the route in symfony 2? The route: my_shop:

Property 'url' does not exist on type 'Event' for Angular2 NavigationEnd Event

谁说我不能喝 提交于 2019-11-30 20:23:59
this.subscription = this.router.events.subscribe((event:Event) => { console.log(event.url); ##### Error : Property 'url' does not exist on type 'Event'. } Typescript doesn't recognize the properties of the type Event that is built into the Angular Router. Is there something on tsd that I can use to solve this? Event is the super class of classes NaviagationEnd, NavigationStart You have to import { Event } from @angular/router; . Try moving console into the if block with condition. this.subscription = this.router.events.subscribe((event:Event) => { if(event instanceof NavigationEnd ){ console

Routing in Rails making the Username an URL:

走远了吗. 提交于 2019-11-30 20:23:01
问题 In my Rails App there is Device Model - User, and a Registry model( Each user has one registry). I wanted to change my routes so that instead of: "http://localhost:3000/registries/3" it shows: "http://localhost:3000/erinwalker" So I changed routes to match '/:name' => "registries#show" And the show action in my controller to: def show @user = current_user @user = User.find_by_name!(params[:name]) @registry = @user.registry And it works, but when I create or update the registry now first it

Angular 2 Routing based on query params

耗尽温柔 提交于 2019-11-30 19:41:45
Is it possible in Angular 2 to define routing based on query parameters? I'd like to have the following behaviour: If the user enteres the url http:<server-path>/search I'd like to route to a StartPage component. If the user enteres the url http:<server-path>/search?query=sometext I'd like to route to ResultList component. I know that it's possible to use path parameters for routing but this is not what I like to do. I want to use query parameters if possible. I know how to trigger navigation in angular with query parameters but I don't know how to configure the Routes. So you can't define a

In Symfony 2, how do I handle routing for multiple domains?

三世轮回 提交于 2019-11-30 19:32:44
问题 I have my app setup to use 3 subdomains, I also have 2 domains that point to the same app, giving me this set of FQDNs admin.domain1.com, admin.domain2.com www.domain1.com, www.domain2.com kiosk.domain1.com, kiosk.domain2.com In routing.yml I can set up the host / resource keys to point those domains at the relevant bundle, but I can only do it for one of the domains at a time. incompass_admin: host: admin.domain1.com resource: "@IncompassAdminBundle/Resources/config/routes.yml" incompass_web

Can you explain the Functionality of requestRouteToHost() in android?

∥☆過路亽.° 提交于 2019-11-30 18:49:43
问题 In my code I am using requestRouteToHost() method: Does this routing means changing the WIFI to 3G or vice versa?? My code is not working... public static boolean isHostAvailable(Context context, String urlString) throws UnknownHostException, MalformedURLException { boolean ret = false; int networkType = ConnectivityManager.TYPE_WIFI; ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if(cm != null){ NetworkInfo nf = cm.getActiveNetworkInfo(

nested form_for singular resource

别来无恙 提交于 2019-11-30 18:30:57
问题 I have a singular nested resource like so: map.resources :bookings, :member => { :rate => :post } do |booking| booking.resource :review end Giving me these routes: new_booking_review GET /bookings/:booking_id/review/new(.:format) {:controller=>"reviews", :action=>"new"} edit_booking_review GET /bookings/:booking_id/review/edit(.:format) {:controller=>"reviews", :action=>"edit"} booking_review GET /bookings/:booking_id/review(.:format) {:controller=>"reviews", :action=>"show"} PUT /bookings/

routing error with :username in url

喜你入骨 提交于 2019-11-30 18:14:24
问题 I have a Rails 3 question. I want to get my users controller show page to have the app.com/people/username url. Route resources :users match "/people/:username" => 'users#show', :as => :profile It's work, but if username starts with "." (dot) I have an error: No route matches "/people/.G" And <%= link_to current_user.username, profile_path(current_user.username) %> raise an exception: No route matches {:controller=>"users", :action=>"show", :username=>".G"} Sorry for my English, Thanks! 回答1:

How to redirect (301) when changed routing translation?

主宰稳场 提交于 2019-11-30 18:10:39
问题 I am looking for an easy way to make redirects in my application. SITUATION: I have routes like this: http://myapp.com/authors/5-hemingway/books/1-moby-dick The routes are translated this way (using gem 'i18n_routing'): http://myapp.com/acutores/5-hemingway/libros/1-moby-dick Now, I changed translation of acutores to scriptores. Easy step but I'd like to redirect all routes that contained an old "acutores" resource name to routes with "scriptores" instead. My guess is, I should play in routes