Update Windows Form UI with Network Available Change Event

.Net frameworks 2.0 has a new namespace System.Net.NetworkInformation, which you could use to gather various network statistics on the machine, it also provide two interesting events NetworkAddressChanged and NetworkAvailabilityChanged. If you are writing winform application and want to update some UI information based on network availability status, then Network availibility changed event is very handy…


Does your application require customizing System.Net.WebPermission, SocketPermission or DnsPermission settings?

.Net frameworks comes with deefault security settings where components running under Intranet, Internet Zone can only have WebPermission to connect back to the server, from where they are downloaded. Also the component from Intranet zone and Internet zone don’t have any SocketPermission and DnsPermission by default. I am trying to find out some real world usage…


Resuming broken file download with FtpWebRequest class

This post is valid for .Netframeworks 2.0 When we are downloading a large file from ftp site and connection got broken in between, on next attempt you would be interested in downloading the rest of the file content instead of full file. FtpWebRequest class have a nice way to meet this requirement. You could use the…


Create your own asp.net hosting server with System.Net.HttpListener

.Net frameworks 2.0 contain HttpListener class under System.Net namespace and a number of ASP.Net hosting classes under System.Web.Hosting namespace. HttpListener class is implemented on top of low level protocol stack http.sys, probably you also know that IIS 6.0 is also architected on top of http.sys. So user of HttpListener class could get advantage of many of the…


Configure System.Net.HttpListener to listen for SSL

Whidbey contains cool class HttpListener under System.Net namespace, it allows you to create your your own HttpServer on top of HttpSys. Some of you aske about steps for configuring HttpListener to work with SSL. Basically you need to configure httpsys. You need to  bound particular port to a server certificate, where you want your listener to…


HttpWebRequest.GetResponse() gives “HTTP protocol violation” error after .net frameworks service packs

This blog is valid for users of .Net frameworks 1.0 SP3 and .Net frameworks 1.1 SP1 The error is really because server is sending response with bad header format, which violates the http protocol specifications. These changes had been made to disallow bad headers. Bad http header could cause security vulnerability based on response-splitting and other attacks based…


C# sample to open command prompt for other than currently logged user

.Net frameworks 2.0 have some new cool managed APIs. Here is one sample. It is common need to run a process on a user account other than currently logged on user. Following is the simple handy code which I use to open a command prompt with amin previleges, when I am logged on as normal user….


7 Habits of successful software company

Yesterday I was looking at one of my longtime favorite book “7 habits of highly effective people” on my desk, I suddenly realize how these habits could easily map and summarize the charactersitics of successful software company. Here is what I come up with Be proactive – Do not wait for customer to create demand or…


Sample code for parsing FtpwebRequest response for ListDirectoryDetails

This posting is valid for .Net frameworks 2.0 (Currently released as Whidbey Beta1) ResponseStream of FtpWebResponse provides the raw data bytes to the user, some of you had asked that it would be more useful to provide methods which return list of directory and files on ListDirectory request to the server. Current .Net frameworks doesn’t support this, so here is…


Understanding the basic of FtpWebRequest programming model on .Net frameworks

A long standing complain from user of .Net frameworks was that it doesn’t have support for popular ftp protocol. This concern is going to addressed in .Net frameworks 2.0. Recently released Whidbey Beta-1 contains FtpWebRequest, FtpWebResponse classes to support FTP protocol. WebRequest/ WebResponse Model .Net frameworks support for FTP protocolo is implemented on top of WebRequest/WebResponse…