router

How to get user's public IP if the server is behind a router?

我与影子孤独终老i 提交于 2019-12-04 11:17:41
How can I get the user's public IP if my server is behind a router? I'm trying: protected string GetIPAddress() { System.Web.HttpContext context = System.Web.HttpContext.Current; string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(ipAddress)) { string[] addresses = ipAddress.Split(','); if (addresses.Length != 0) { return addresses[0]; } } return context.Request.ServerVariables["REMOTE_ADDR"]; } but all I get is the router gateway. Apparently, REMOTE_ADDR won't work in my case and neither will HTTP_X_FORWARDED_FOR . Any ideas on how to get the

Rails + SSL: Per controller or application-wide?

风格不统一 提交于 2019-12-04 10:25:22
问题 I could use some wisdom from any developers who have worked with Rails and SSL. I have a fairly simple app and I'm in the process of implementing payment processing. Obviously payment processing calls for SSL, so I'm setting that up now. My intention when I started working on this today was to find the simplest / cleanest way to enforce SSL on specific controller actions - namely anything having to do with payment. I figured there was no reason to run the rest of my site on SSL. I found the

How to use multiple router-outlet in angular2?

天涯浪子 提交于 2019-12-04 09:01:47
问题 I have a main router-outlet , which is used to display a login screen ( /login ) and the main content screen(which is shown after login) ( /main ). Once the user is on content screen, I want to show a nav-bar on top, with 2 options(say, 'Overview', 'Insights'). This nav-bar is common for OverviewComponent and InsightsComponent Below this nav-bar, I want to show another router-outlet, which would load OverviewComponent or InsightsComponent , based on what user clicks in nav-bar. If I give '

emberjs: how to trigger a custom event in a View

断了今生、忘了曾经 提交于 2019-12-04 06:46:38
问题 I would like to turn a primitive event (a click) into a semantic event, like "deleteTodo" This is described here, but not how to implement :( I have the following code: App.TodoView = Em.View.extend({ click: function(e) { this.trigger("deleteTodo"); } }); App.Router.map(function(match) { match('/').to('index'); }); App.IndexRoute = Ember.Route.extend({ deleteTodo: function(e) { // this code is never executed :( } }) ; After I perform the 'click', I see that the TodoView click function is

How to get GET paramater in Angular2?

混江龙づ霸主 提交于 2019-12-04 05:16:07
问题 By accessing myproject.dev/people?filter%5Bindustry%5D=finance&filter%5BstartWith%5D=a , Angular2 point the url to myproject.dev/people Here is my RouteConfig: @RouteConfig([ { path: '/people', name: config.route.main, component: MainComponent, useAsDefault: true } ]) In MainComponent: /// <reference path="../../../typings/angular2.d.ts" /> import {Component, Injector} from 'angular2/core'; import {ROUTER_DIRECTIVES, Router, RouteParams} from 'angular2/router'; import {BaseResourceComponent}

Angular 2 nested routes resolve execution

梦想与她 提交于 2019-12-04 02:59:20
For example if I have following route organization: const appRoutes: Routes = [ { path: "", component: AppComponent, resolve: { app: AppResolver }, children: [ { path: "", component: NestedComponent, resolve: { subscribers: NestedResolver } } ] } ]; and following resolvers: export class AppResolver implements Resolve<any> { constructor(private appService: AppService) {} resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> { return this.appService.getAppData(); } } export class NestedResolver implements Resolve<any> { constructor(private nestedService:

can one computer have two mac addresses?

笑着哭i 提交于 2019-12-04 02:23:00
I hope this was the right place to post this, sorry if it isn't. Also, I know next to nothing about networks. I'm trying to allocate bandwidth to different devices on my Linksys E1200 router. When I check my computer's MAC address, it comes back as 74:E5:0B:10:01:04 . I turned off everything in my apartment besides my xbox and notebook, and under the DHCP client table under my router settings I see the xbox along with " Owner-PC " and a MAC address of 00:21:6B:10:A8:6E . Is this my computer, and if so, why are there different MAC addresses? MAC Addresses are NIC specific.. Each Network

Angular2 Exploring Resolved Data in canActivate Guard?

纵然是瞬间 提交于 2019-12-04 02:08:24
Is it possible to access resolved data of a route (-Resolver) inside a canActivate guard. Currently I can access the resolved data in the component by ngOnInit() { this.route.data .subscribe((data: { example: Array<Object> }) => { this.example = data.example; console.log('example resolver', this.example); }); } How could I manage that in the canActivate guard? This is not working: constructor(private route: ActivatedRoute) {} canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot, ): boolean { this.route.data .subscribe((data: { example: Array<Object> }) => { this.example =

Finding out distance between router and receiver?

旧街凉风 提交于 2019-12-04 01:38:33
问题 A general question: is it possible to retrieve information about how far away e.g. a computer is from a wifi-router. For instance I want to get data on my computer if I'm 10 meters away from my home-wifispot or 2 meters. Any idea if that is even possible? Edit: How about bluetooth? Is it possible to get information about how far away bluetooth-connected devices are one from another? 回答1: I would recommend a measuring line or just good-old-fashioned guesstimating. There is no "simple" way to

Multiple routers vs single router in BackboneJs

时间秒杀一切 提交于 2019-12-03 18:22:33
问题 All examples on Backbone I've seen use one router for the whole application, but wouldn't it make sense to have a router for each single part of your app (header, footer, stage, sidebar)? Has anyone built apps with more than one router and what are your experiences? Let's think about a complex app with nested views: Wouldn't it be better when a view has its own router that handles the display of the subviews, than having one big router that has to inform the main view to change its subviews?