In .NET 2.0 System.Web.SmtpMail has been changed to System.Net.Mail.SmtpClient.More information at MSDN – System.Net.Mail Namespace.
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”];
Can ASP.NET 1.1 applications work along with ASP.NET 2.0 applications?
As long as you have ASP.NET 1.1 and ASP.NET 2.0 installed on your server, both types of web applications will work fine. When you install ASP.NET 2.0, ASP.NET 1.1 doesn’t get uninstalled so you don’t have to worry.However, after you install ASP.NET 2.0 make sure you put your ASP.NET 2.0 web applications on a different […]
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, […]
How do I change the mouse cursor to a hourglass?
With .NET you can easily change the current cursor by using the Cursors class. To change the cursor to a hourglass, we’ll be using the WaitCursor: this.Cursor = Cursors.WaitCursor; To change it back to normal after the application has stopped loading: this.Cursor = Cursors.Default; As IntelliSense points out, you can change the mouse cursor to various shapes (crosshair, […]
How to launch an URL in the default browser
If you pass a URL to the Windows Shell, it will open it with the appropriate application, in this case the default browser. Thus, to launch the Geekpedia website in the default browser, the following code is needed: System.Diagnostics.Process.Start(“http://geekpedia.com”);
How can I set the date of a Calendar control to the current date?
Most of the time when using a calendar in your Windows or web application, you’ll want to set its initial date to the current date. This can be easily done using the SelectedDate property: Calendar1.SelectedDate = System.DateTime.Now;
How can I compress files from my C# application?
If you want to reduce the size of a file from your .NET application you will probably want to use a library that compresses this file using GZip/Zip or other similar type of compression.There are numerous libraries for this, such as: SharpZipLibPowerTCP Zip CompressionXCeed Streaming Compression for .NET
How can I set the ASP.NET validators to be visible by default?
To make the validators on a page visible by default you can call the page’s Validate() method when it is loading, as in: private void Page_Load(object sender, System.EventArgs e){ if (!IsPostBack) { Page.Validate(); }} Or if you want to make visible only one validator, use: private void Page_Load(object sender, System.EventArgs e){ if (!IsPostBack) { // Where reqEmail is […]
In .NET 2.0 Form.Flash and Form.StopFlash seemed to disappear…
They indeed disappear. As Erick Ellis from Microsoft explains: We removed the Flash API because it was too simplistic and failed to address the core scenario which is Messenger’s use of flash. You could stop and start it, but you couldn’t control duration, end state and several other aspects. We just had to pull the plug […]