How to monitor external traffic to my local IIS server? - mobile

I'm developing for mobile devices and to debug I connect devices on WIFI to my IP address. It works well for developing on hardware and debugging on my machine. The only thing I can't make to work is how do I set up Fiddler so it sees traffic coming from external clients?
If I open my site from browser on same machine - fiddler get's it. But when I connect to my PC by IP address from another machine - fiddler doesn't see it.
I have proper settings (I think)

You need to configure Fiddler as a reverse proxy. See Using Fiddler as a Reverse Proxy.

I got this to work by simply changing the IIS Application Pool whose traffic I wanted to inspect to run under my identity, since Fiddler seems to only capture traffic of the logged in user by default. Just make sure your user has all of the necessary permissions required by IIS; I'm an admin so this wasn't an issue for me. And of course, don't forget to change the IIS Application Pool identity back when you are done.
The other option of course is to instead log in as the user that the IIS Application Pool is running as (if it's not a service account like Network Service) and then run Fiddler while logged in as that other user.

Related

Dev server test for app engine when communicating with other server

I'm using Google App Engine Standard to write a small application, let's call it AppX.
AppX is supposed to receive a POST message from another website, let's say B, and then do some processing and show on its mainpage.
The question is:
I don't know how to use dev_app server to debug. As if I use dev_app server, the server will run locally without https, then I don't know how to send a POST message from website B.
Google cloud shell is a very limited shell too, which does have limited ports enabled for outgoing connections only.
Although there might be a way to configure it, I think the easiest way to test calls from website B to a dev_app would be configuring a GCE virtual machine with a fixed IP. There you can configure the firewall freely, and also not worry any non-interactive session to finish abruptly.

Connect to the Wi-Fi network from within the app without internet access

I am developing hotspot helper application which tries to connect to the captive network after connecting to it, I need to handle the authentication within the app.
Approach 1
I used NEHotspotConfigurationManager in order to programmatically connect to the WiFi network and it works great. The problem i am facing is after connecting to the captive network iOS does not send the request to the connected network until the connected network has internet access or I manually go to the settings and it pops up the web page for authentication and i click cancel and select use without internet.
Approach 2
Second approach i used is by using NEHotSpotHelper as described in this tutorial
In this approach when I receive the commandType authenticate it does not send request to the Wi-Fi network (If the device is connected to the 4g the request goes over it otherwise it returns internet connection appears to be offline)
So how can i authenticate the user from the app after connecting to the WiFi with limited access?
I found that developer need to bind the request with the received command before making web request to the connected network. All you need to do is to make NSMutableURLRequest and then call hitTestURLRequest.bind(to: command) because bind function is defined in the category of NSMutableURLRequest.
Related question: https://stackoverflow.com/a/50753526/1796092

Mobile Hotspot Replaces Site Address With Incorrect IP

On some of our web apps, when a user connects via a Verizon 5510L Jetpack mobile connection the site address is replaced with an incorrect IP address, and of course throws a 504 error.
Has anyone else ever experienced this? or know why this is happening?
We have other apps that are very similar, on the same server that do not have this issue. Unfortunately this is a popular device with our customer so avoiding the hardware is not an acceptable fix.
As a workaround, the user can connect to the site via a different connection, keep the browser open and connect to their mobile device. This Also is not an acceptable fix as the applications are often used in remote areas.

Silverlight app - service URL cannot handle IP address

I have a Silverlight app that run on a single server which also hosts the web service used for data access. This is a Service Reference in the project. A common issue is that someone browses to the app using an IP address rather than the machine name. This breaks because the app thinks this is a cross-site violation.
To access the web service we create a System.ServiceModel.ClientBase and assign is an address in the web.config file. So locally in dev this is localhost:xxxx, and in production is it the machine name. Or we could set it to the IP address, but then everyone would have to go to the app using IP address only.
Is there a good way to do this? One issue is that some people access the app internally where the machine has a good name, while others access it through a VPN where they may need to use IP. I would like for both to work.
FYI I had this same issue. silverlight application and wcf service running on same server, but when application is started using an ip address vs. application url, then cross domain problems occur. evidently these urls/ips are not resolved/matched locally so to the silverlight application, they look like different domains. My app is running as an application and couldn't be moved to root of iis web site for technical reasons which is required for a clientaccesspolicy.xml file or crossdomain.xml to work properly.
I solved it by adding an entry into the hosts file on the server with the ip address and name of the domain. This looks a bit strange since we are on the server pointed to by the ip address and the domain/machine name but it works.
Adding this locally in the hosts file evidently redirects all requests for the ip address to the server PRIOR TO making either the call to get the silverlight application or the call the wcf service, so they look the same no matter whether the application or the service is called using an ip address.
Hope this helps anyone else in the future.
FYI - this does not work with VMs
We use VMs for some functionality and I have found this just doesn't work when running clients from the VM. The VM manager must do something to the request before passing it through. Just thought I'd mention this for future use.
Have you tried creating a clientaccesspolicy.xml file?
http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx

Silverlight Client UserName

I am trying to return the Client UserName back into Silverlight by using HttpContext.Current.User.Identity.Name in the .aspx page that starts the application.
I have this hooked up to InitParams working fine passing it into silverlight with the ASP.Net Development Server but when I change to an IIS Web site it returns an empty string.
All of our users will be on the same IP subnet with different domains. This is a intranet app. I need to know who they are, preferably without authenticating, in order to load the proper interface. I do not have any Windows or Forms authentication established in the app yet.
....is it possible?
Without authentication on the server-side, I believe this is not possible. You'll have to have the ASP.NET page authenticate in order for it to write the client's username into that init param.
The test web server's process is running as the local developer, it probably appears to be working since both the client and server are running as the same user.
Suggestion:
Enable Windows authentication in IIS for that application folder that hoses the ASP.Net page. Disable anonymous. This should (in theory) be fine for the intranet. At this point I think you should be able to get Authenticated user from HTTP context. We use Thread.CurrentPrincipal.Identity.Name since we're doing this in a WCF web service.
Not all browsers support Windows authentication. IE and Chrome seem to work the best. Firefox requires you to enable this per-site (look up the "trusted-uris" settings, note that Negotiate and NTLM are separate settings). Safari and Opera as well as non-windows clients, I'm not sure any more.
To get more consistent support across browsers look into the "alternative" client HTTP in Silverlight. However, I guess this wouldn't work with setting init params in the asp page. If you could make an additional request to another ASP page (or a web service) to get the user after loading you could choose to use this other http stack. I found it supports authentication itself, regardless of the browser.

Resources