Implementing a generic TCP/IP socket proxy in ASP.NET
I frequently work in places where I only have access to the internet via a HTTP proxy. E-mail protocols like SMTP, POP3 and IMAP 4 are not proxyable via http (normally) so I download mails via GPRS/UMTS when needed. The problem is that it costs a fortune when someone sends you a gigantic .ZIP file.
I got fed up by wasting time and money this way so I implemented a simple ASP.NET based solution than can proxy any tcp/ip socket via http/https. You can find the binaries, as well as the source code, in the downloads section. I have been dogfooding the last few days, adding features as I need them. The tool is pretty basic but it does what I need:
- it runs as a windows form or a toolbar icon
- it supports an optional upstream http proxy
- all traffic is encrypted with https
- it handles all tcp/ip socket based protocols I have tried so far: smtp, pop3, http, https, Microsoft Terminal Services.(mstsc is slower, but it works like a charm via a https proxy for emergency purposes)
I hope the code is understandable even if it is fruit of late night coding sessions while I am on a tight deadline for not one, but two, releases in the middle of the night next week. Releasing solutions based on Java 1.5/Tomcat 5.5 and .NET/Win2k3 in the same week keeps life -busy- but interesting. At least I learn something new every day. There are a lot of possible improvements like automatically importing the proxy settings from the default browser and adding authentication support but I don't need them (yet)