The first version of Silverlight (formerly WPF/e) was recently released and can be downloaded from Microsoft’s web site.
Contrary to what many people believe, Silverlight is not simply a rich media player for the web. Nor is it just a replacement or a competing product for Adobe Flash. Silverlight is a technology that allows developers to deliver Windows-like rich user experience to the web. This includes animations, vector graphics, music, movies, etc., but it also includes the ability to develop WinForms-like applications with grids, treeviews, toolbars, and so on and so forth.
To get started with Silverlight, checkout these videos, or see this demo by Scott Guthrie and Jason Zander on the .NET Show. If you are looking to develop a WinForms-like user experience, you may also appreciate GOA WinForms which is an implementation of standard System.Windows.Forms .NET library for both Adobe Flash and Silverlight.
In .NET 2.0, apsnet_regiis can encrypt and decrypt sections of web.config and machine.config using RSA, DPAPI, or any other custom encryption provider. However, how do we encrypt/decrypt a custom application configuration (e.g. app.config of a WinForms application)?
We are in luck, since the System.Configuration namespace provides everything we need to accomplish this task. The following class, for example, can be used to encrypt/decrypt any .NET configuration file:
///
/// Implements a utility class that enables encrypting / decrypting
/// sections in .NET configuration files.
///
internal static class ConfigEncryptionHelper
{
#region Encryption Methods
///
/// Encrypts a section in a .NET configuration file using a named provider.
///
/// Physical path of configuration file.
/// Section name to encrypt.
/// Name of the encryption provider.
public static void EncryptConfigSection(string configPath, string sectionName, string protectionProviderName)
{
// Map the configuration file
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = configPath;
// Open configuration file
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
// Get the desired section
ConfigurationSection section = config.GetSection(sectionName);
// Encrypt the section
if (!section.SectionInformation.IsProtected)
section.SectionInformation.ProtectSection(protectionProviderName);
// Save configuration file
config.Save();
}
///
/// Encrypts a section in a .NET configuration file using DataProtectionProvider.
///
/// Physical path of configuration file.
/// Section name to encrypt.
public static void EncryptConfigSection(string configPath, string sectionName)
{
EncryptConfigSection(configPath, sectionName, "DataProtectionConfigurationProvider");
}
#endregion
#region Decryption Methods
///
/// Decrypts a section in a .NET configuration file.
///
/// Physical path of configuration file.
/// Section name to encrypt.
public static void DecryptConfigSection(string configPath, string sectionName)
{
// Map the configuration file
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = configPath;
// Open configuration file
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
// Get the desired section
ConfigurationSection section = config.GetSection(sectionName);
// Decrypt section
if (section.SectionInformation.IsProtected)
section.SectionInformation.UnprotectSection();
// Save configuration file
config.Save();
}
#endregion
}
Perhaps the best kept secret (or at least the least discussed feature) of Visual Studio 2005 is the client-side reports. Client-side reports consists of the Report Viewer Control and it’s accompanying Report Designer that comes standard with Visual Studio 2005 Professional and up.
This feature can be used to develop ASP.NET or WinForms solutions that sport SQL Server Reporting Services style reports, without having to deploy those reports to a Reporting Server. Reports are deployed as RDLC files with your solutions. In fact one doesn’t even need SQL Server, since these reports can be programatically bound to objects such as DataSets, a huge plus for ditributed n-tier designs where the UI layer does not have direct access to the data store. This also means that one can use any imaginable back-end data store including XML and CSV files as long as data can be loaded into binable objects.
The report viewer control is similar to Reporting Services report viewer, with nifty features such as paging, searching, and export (PDF, Excel, CSV) features. My only complain with the ASP.NET version of the report viewer is that it does not directly support printing. Reports have to be exported to PDF in order for one to print. This was a gotcha with the first versions of Reporting Services report viewer as well, but later they added printing support to the control (perhaps through ActiveX) in Reporting Services SP1.
You can find more information about this feature at GotReportViewer.