Free Microsoft Press e-book : Writing Secure Code for WINDOWS VISTA


I’m looking for good references for security guidelines on developing  with security on .net and came across this free E-book from MS Press: I’m reading thru a bit by bit and found some good gotchas specially on Chapter 2 on the topic "Debugging Application Compatibility Issues in Windows Vista" which I think is very useful today because of Vista being the primary target Application Development.

Quoting the MSPress site "This reference is ideal for developers who understand the fundamentals of Windows programming and APIs. It complements Writing Secure Code, examining the delta between Windows XP and Windows Vista security."

More info are available at:


Getting all available network interface using NetworkInterface namespace

By using the NetworkInformation namespace
you can get all of the available network interfaces on the current machine.
This is very useful for  applications that are network aware 
or that require to configure the network adapters.
using System.Net.NetworkInformation;
   1:  //Iterate to all available network interfaces
   2:  foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
   3:  {
   4:      // Filter to load only configurable interfaces
   5:      if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet |
   6:           netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
   7:      {
   8:         //Use the ff as strings, add to a collection or a list
   9:          netInterface.Name.ToString();
  10:          netInterface.Description.ToString();
  11:      }
  12:  }

The above snippet came from a little project that I wrote for me and my Amy that configures our wireless and cabled adapters. Because we both have laptops that connects to both of our office wireless, LAN on their conference (no wireless signal there), wireless in the condo, wireless at Bataan (ssshhh its free, but we need to configure your DNS to SMART BRO :P, it seems that their neighbor has DHCP but did not configured / or has hidden the DNS) 

Sending data to and receiving data from a resource identified by a URI thru WebClient


As I have posted on about using a System.Net.WebClient to "Post" a Collection instead of posting this string postData = "client_id=" + 318 + "&tracking_id=" + 2000 thru HttpWebRequest. You can use this:

   1:  //Declare your Name-value Collection
   2:  System.Collections.Specialized.NameValueCollection objCollectionToPost = new NameValueCollection(2);
   4:  //populate your collection
   5:   objCollectionToPost.Add(“client_id”, 318);
   6:   objCollectionToPost.Add(“tracking_id”, 2000);
   8:  //Instantiate  your System.Net.WebClient
   9:  WebClient objClient = new WebClient();
  10:  objClient.BaseAddress = “https:/”; 
  12:  //To capture the response, you may use a byte[ array or a long string, your implementation
  13:  //would depend on what you think is the response will be
  14:  // for this instance I will use a byte array (you will notice why siguro at the end)
  16:  Byte objResponseCollection;
  18:  //This is the actual posting, you would notice that when you UploadValues to the 
  19:  objResponseCollection = objClient.UploadValues(objClient.BaseAddress, "POST", objCollectionToPost);
  21:  //since most likely it would be a length of bytes, and I know from the documentation of your payment
  23:  //gateway, that this will be a “Comma Delimited” string, I will process it as follows
  25:  String objRetValues;
  26:  objRetValues = System.Text.Encoding.ASCII.GetString(objResponseCollection).Split(",".ToCharArray());
When you post WebClient usually returns the response of the payment gateway. 
The response is usually a long string that you need to split into a specified delimiter. 
In my example I already know that the gateway will return a "Comma Delimited" String based on the documentation I got from the payment provider.
For more info on WebClient go to msdn: