Forcing reuse of connections when doing Windows Authentication

When doing authentication, HttpWebRequest manages connections differently, depending on the authentication mode being used. If it uses Windows Integrated Authentication, it will close the connection after every request completes. The reasons for this are complex, and I wont go into them at this point. However, there are cases where you dont want this to happen….

Printers are watching you!

Someone sent me a link which talks about how printers are embedding tracking information in pages that they print. Spooky!


Async Programming Model – Reloaded

This topic is about the asynchronous programming model, and how it is used when doing Networking.   Introduction to Asynchronous Programming   The DotNetFramework supports an asynchronous programming model that is uniform across all classes & features in the framework. What is cool about this model is that there is a uniform way of doing…


HttpWebRequest and PreAuthentication

The topic of this post is PreAuthentication. HTTP Webservers support multiple authentication options. On Windows, IIS supports Basic, NTLM, Digest, Negotiate (a.k.a Integrated Windows Authentication). Of these, Basic & Kerberos support PreAuthentication. “PreAuthentication” is sometimes misunderstood to mean “Send credentials on the very first request”. That is not the way it works. For Preauthenticate to work,…

Downloading content from the web using different encodings

The other day, somebody asked me: How do I download a webpage, or other content from a webserver, where the content is stored using a specific encoding ? They want to do this using for eg: System.Net.HttpWebRequest Why is this necessary ? Well, for starters, webservers around the world store their content in various encodings….


A tale of threads

Today’s lesson is about thread interaction between Asp.Net and the HttpWebRequest object of the System.Net namespace. The CLR provides a threadpool. This facility provides threads for normal work ( worker threads ), I/O work ( I/O threads) and Timer Threads. Normally, the limit of threads for managed processes is set as follows: WorkerThreads: 25 per…


HttpWebRequest and Connections

The .NET Framework has a HttpWebRequest object in the System.Net namespace. This object allows you to talk to HTTP Servers. Usually, people forget that the underlying connection created by the request is not freed up,unless you call Close() on the response. So, you hit the connection limit, and no more webrequests will go through. This…



Welcome to my blog! This blog is a place for raves and rants about everything in general, and networking in particular. Watch this space for cool tips and tricks, code samples and other random stuff.