I need to create a c# application that intercepts http traffic from the user's browser (Firefox, chrome) by adding proxy settings in the browser and then show the HTTP headers of the request without using any third party plugins like FiddlerCore.
I found some examples using HttpListener but none of them show the headers.
if you interested to build a simple proxy server then you can take look here.
http://www.dreamincode.net/forums/topic/288683-a-simple-proxy-server-in-c%23/
there are few lines from there
I have written a simple and minimalist HTTP proxy server that runs on command line.
In the Start() method, a TcpListener blocks until it gets a client request and creates a new thread (ThreadHandleClient method) that processes this client, fetches its url and relays data.
Related
From my understanding, the beauty of signal R is that it takes care of the "handshake" between the client and server to determine the best form of communciation between them (websockets, long polling, etc). I understand that by default it does this at the /signalr route. I read that before this the handshake would be accomplished with an HTTP Get request with an Upgrade/Connection header specifying to upgrade to this new connection.
In my current application we support handling many HTTP requests in a RESTful manner. If we wanted to expose some of this data in real time rather than in this request response format, what would be the best way to determine if we should open a connection using signal R? Would checking for those headers still suffice? I just feel like that is a bit redundant since signal R abstracts that away.
Instead of this, would a solution be for the client to specifically invoke a hub method to kick off the streaming as soon as he connects to the proper endpoint?
TLDR: Need a way to open a signal R connection from a HTTP request, don't know the best way to go about that whether it be from requesting the resource with custom HTTP headers or by just navigating to the url resource and having their client invoke a hub method.
A typical example of using signalr is:
an html file using JavaScript to connect to a signalr Server when the page is loaded. we call this signalr client.
a signalr server written in c#. it can be a winform or console or service.
the signalr Server can call any dll, or webservices or webapi located in the same server, or even in different Server.
then, the client can call any function defined in the signalr server. the server can call any function defined in the client for a particular client or for groups of clients.
also, client x can call client y functions as well.
I would also suggest you create this index.html inside a Cordova project, so that your client can use this app using any pc desktop browser, or any mobile phone browser, or run it as an Android or iPhone native app, by using One set of client codes.
if they navigate to some url resource instead of receiving a response with json in its body we want them to be constantly in real time using signal r receiving data
I don't think this is possible with SignalR. Reason is that all SignaR communication is done through single route (xxx.xxx.xxx.xxx/signalR) + all SignaR connections are established using handshake (By client sending negotiate request to this route. Well maybe not all - not sure if negotiation is happening in case you initialize SignalR connection object with specific transport).
I am calling a third part web service from a windows application. I just tried to capture the xml response and request generated by that web service while I called it, but failed. While searching Google I found lots of articles, followed their instructions and code, but nothing works.
As examples of what I found, I followed these instructions and these.
Can anyone tell me any easy way to capture incoming and outgoing xml when I call and work with web service returning and accepting XML?
Using Fiddler or Wireshark you are able to capture http traffic on the client.
I'm normally using Fiddler, it registeres as a proxy on the client so if the application is using the proxy settings defined in the Internet Options all traffic automatically shows up after starting Fiddler.
i want to create a proxy server or (Socks host ??) to communicate with browsers (such as firefox) to forward http proxy.
i have a software that do this: bitvise tunnelier.
so, i need to write an application similiar to tunnelier proxy forwarder.
in other words, i want to enable firefox Socks Host and get browser request with c# application
Please help me lead the way
thanks a lot
Create a proxy means that your application need to act as an HTTP Server when talking to the clients (the browsers) and act as a browser when comunicating with the web sites.
The proxy opens a port for the server socket (for example port 90) and accepts the browser request on this port, than connect the web site (generally on port 80) and forward the request to the site server. The proxy waits for the server response, read it and after send the response to the client.
The proxy changes the messages header if needed ( for example change the port in the url).
In general proxy are multi thread applications, so they can manage more request in the same time.
Is it possible to get all HTTP requests of a browser?
For example: we have opened the browser, navigated to google.com, searched for a string, clicked on any link and I got some error.
Now I want to track all HTTP requests from opening browser.
We have been using 'fiddler' to do so. But we want to use C# code to track all HTTP requests as well as HTTP responses. And we want to use the failed HTTP responses in our program.
Any information on this will be very helpful.
You could use SharpPcap to implement your own 'sniffer', or use a HttpListener to create a proxy that forwards web requests.
AFAICS, there is no way of implementing this which does not replicate what you are already doing with fiddler (albeit that you could implement a passive sniffer rather than a proxy).
I have a project where I have created web service proxy classes with wsdl.exe and then simply create an instance of that class (inherits System.Web.Services.Protocols.SoapHttpClientProtocol) and call the method that should send a SOAP message. I'm using Visual Studio 2008 if that matters. And I'm trying this in my development machine without access to actual web service that is located inside of customer's intranet. So, the sending will of course not succeed and I will not get any response back but all I would like to see is the exact content of SOAP messages this solution creates and tries to send. How do I see that?
Use fiddler.
Have a look at SOAPUI from eviware.com.
Its a free for personal use Java app. Among other things you can
set it up to run as a dummy test server. Just load up hte WSDL
and enter the dummy data.
In test server mode it will log your requests so you can see whats happening
inside the request message.
If you're Web service is accessed by clear text, non-SSL HTTP, you can just use a sniffer, like Wireshark, to see the data coming from and to your application. Wireshark can trace, filter and analyze wire data. I have used it do debug HTTP and other protocols many times, and it's a great tool to do this.
SOAP messages are simply XML data sent using the HTTP POST method. So you can for example install a local web server on your development machine, configure your web service to use some dummy URI on this server, and grab the network traffic with WireShark (AKA ethereal). The big advantage of this method is that it involves no coding.
Alternatively you can use an HTTP echo server that dumps its incoming traffic, like this one (found while googling "http echo server"):
You can intercept the call with tcpMon