Tips & Tricks
Everything you ever wanted to know but never dared to search for...

Read HTML web page in a string variable

WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream());
string result = sr.ReadToEnd();
sr.Close();

Working with Windows Registry keys

Create a registry key:

RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\APP\\MyKey\\");


Read a registry key value:
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\APP\\MyKey\\");
string myValue = key.GetValue("MyVariable");


Change a registry key value:
key.SetValue("MyVariable", myValue);

Gaetano Causio © | Privacy Policy | Disclaimer