Author: Nathan

In .NET 2.0 accessing the values stored in web.config through System.Configuration.ConfigurationSettings.AppSettings doesn’t seem to work anymore

In .NET 2.0 System.Configuration.ConfigurationSettings.AppSettings has been changed to System.Configuration.ConfigurationManager.AppSettings. Also youneed to add a reference to System.Configuration.dll.Here’s an example of accessing the SomeString value from the web.config file, in .NET 2.0: System.Configuration.ConfigurationManager.AppSettings[“SomeString”];

How do I generate a random number within a range?

Using .NET you can easily generate a random number withing a range, by using the Random class. In the following example a random number between 1 and 69 will be generated: System.Random RandNum = new System.Random();int MyRandomNumber = RandNum.Next(69); To generate a random number between 1986 and 2005 you would use: System.Random RandNum = new System.Random();int MyRandomNumber = RandNum.Next(1986, […]

Back To Top