routing

ASP.NET MVC Default route?

Deadly 提交于 2019-11-28 09:04:51
I created a new ASP.NET MVC project and implemented a site authorization filter. When I map the routes to the {controller}/{action} pair, I pass a role = "SomeRole" default to the route. It works perfectly if I go through the full url ( http://localhost/somecontroller/someaction ) and I specified the full route MapRoute("SomeAction", "somecontroller/someaction", new { controller = "SomeController", action = "SomeAction", role = "SomeRole"); The problem is that when somebody visits http://thesiteaddress.com there has to be a default route that invokes /home/index instead of / and if I specify

How can I forward localhost port on my container to localhost on my host?

ぃ、小莉子 提交于 2019-11-28 09:00:01
I have a daemon on my host running on some port (i.e. 8008) and my code normally interacts with the daemon by contacting localhost:8008 for instance. I've now containerized my code but not yet the daemon. How can I forward the localhost:8008 on my container to localhost:8008 on the host running the container (and therefore the daemon as well). The following is netstat -tlnp on my host . I'd like the container to forward localhost:2009 to localhost:2009 on the host Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:2009 0.0.0.0:* LISTEN 22547/ssh tcp6 0 0

How do I write Routing Chains for a Subdomain in Zend Framework in a routing INI file?

丶灬走出姿态 提交于 2019-11-28 08:48:17
I am trying to create a subdomain using the Zend Router, and then for each section under a subdomain, such as subdomain.site.com/section/ I am creating another route and then trying to chain it to the subdomain route. but I don't know how. I have read all the documentation I could find and all the forums, but it leads me to figure it out on my own. So far, my attempts just get me this error: Catchable fatal error: Argument 2 passed to Zend_Controller_Router_Rewrite::addRoute() must implement interface Zend_Controller_Router_Route_Interface, null given, called in /var/local/zend/library/Zend

how to route to css/js files in mvc.net

瘦欲@ 提交于 2019-11-28 08:15:07
问题 I am trying to add an area to my application using routing in mvc.net. For controllers i added: routes.MapRoute( "Area1", // Route name "Area1/{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); how can i route the css/js files in the same way, i.e. i would like to have area1/content/site.css going to /content/site.css or to /content/area1/site.css . Thanks 回答1: like this for /content/site.css

Rails creating malformed routes with dots

佐手、 提交于 2019-11-28 08:02:15
问题 I'm using the path helper methods to generate URLs in link_to, and they are returning URLs formated like this : http://localhost:3000/tweets.4 when I was expecting them to be formated like this: http://localhost:3000/tweets/4 Note how it is using a dot as the delimiter instead of the expected forward slash. The top link doesn't resolve to the correct view, it simply reloads the /tweets view. When I manually edit the URL to be like the bottom, it opens the correct /tweets/show/. The closest

Permalinks with Ruby on Rails (dynamic routes)

Deadly 提交于 2019-11-28 07:52:32
I am currently developing a blogging system with Ruby on Rails and want the user to define his "permalinks" for static pages or blog posts, meaning: the user should be able to set the page name, eg. "test-article" (that should be available via /posts/test-article) - how would I realize this in the rails applications and the routing file? Veger Modifying the to_param method in the Model indeed is required/convenient, like the others said already: def to_param pagename.parameterize end But in order to find the posts you also need to change the Controller, since the default Post.find methods

rails routing and params with a '.' in them

有些话、适合烂在心里 提交于 2019-11-28 07:49:59
问题 I am using rails to guard access to files that need to be served only to some users of a web app. To do this I have a controller method that accepts information about the file they want to access, checks their authorization, and then if they are authorized uses x-sendfile to send it to them. The concept works fine except for one snag: if they request a resource with a . in it my routing doesn't know to handle it. In my routes file i have: match 'atb_resources/:guid/:resource' => 'atb

asp.net mvc hosting angular app with html5mode and routing

流过昼夜 提交于 2019-11-28 07:47:16
Alright, so I am hosting an angularjs inside asp.net mvc 5 and are using the html5mode(true) in my angular app to get rid of all hash signs in the url. Everything works great, however, with my current setup that looks like this: RouteConfig.cs: routes.MapRoute( name: "Default", url: "app/{angular}", defaults: new { controller = "Ng", action = "Index", angular= UrlParameter.Optional } ); So that when I navigate to http://url/app/myangularroute my Ng/Index action returns the view which contains the ng-view container and the angular app is now active and working with the route provided Now, my

In AngularJS, how to stop ongoing $http calls on query change

一笑奈何 提交于 2019-11-28 07:46:10
I'm calling 4 to 10 $http get calls in parallel. But after user search action I need display to same view but with different result. I populate set of data and new $http query calls. But the previous $http invocations(promises) are still populating or in action, effecting $scope. My possible dirty solution is .. Using multi-app(multimodule) page which can have dynamic regions controlled by a dynamic app. On user events remove the element which correspond to the event. Example, search result, if I want to display results from different sources using different $http calls. If user searches with

Angular 2 add routerLink in child which points to root router

被刻印的时光 ゝ 提交于 2019-11-28 07:31:50
问题 Currently I am developing a web app using Angular 2 Beta 8. Now I am facing a problem with nested routes when using the routerLink directive. The router hierarchy is: AppCmp |-> NewItemFormCmp |-> UserDashboardCmp |-> MyItemsCmp The involved components are: @Component({ ... }) @RouteConfig([ {component: NewItemFormCmp, name: 'NewItemForm', path: '/item/new'}, {component: UserDashboardCmp, name: 'UserDashboardCmp', path: '/me/...', useAsDefault: true} ]) export class AppCmp { } @Component({ ..