Developers Archive for February, 2008

URL Mapping in asp.net 2.0

URL Mapping in asp.net 2.0 Thursday, February 28th, 2008

URL Mapping is a mechanism by which you can change the displayed url in address bar.

Example
Step1: Add Mapping URL in web.config file.

Step2: Change the URL in .aspx file
Department
Product
Employee

Encryption connectionstring .NET Framework 2.0 using Tool

Encryption connectionstring .NET Framework 2.0 using Tool Thursday, February 28th, 2008

Configuration File Encryption

In the .NET Framework 2.0, developers will be able to encrypt sensitive parts of the web.config file (if containing password or keys, for instance) using the aspnet_regiis utility. The decryption is done transparently.
The DPAPI protected configuration provider supports machine-level and user-level stores for key storage. The choice of store depends largely on whether or not the application shares state with other applications and whether or not sensitive data must be kept private for each application.
If the application is deployed in the Web farm scenario, developers should use RSAProtectedConfigurationProvider to leverage the ease with which RSA keys can be exported on multiple systems. It uses RSA public key cryptography to provide data confidentiality.

The following example encrypts the connection string section using the tool aspnet_regiis:
try out this…
aspnet_regiis.exe -pef “connectionStrings” C:\VirtualDirectory\Path

Encrypt and Decrypt configuration files using Code

Encrypt and Decrypt configuration files using Code Thursday, February 28th, 2008

How to encrypt connection string in asp.net stored in web.config.

Using System.web.configuration;
Protected void button_click(object sender,eventargs e)
{
string webconfigpath=”~”;
configuration config=webconfigurationmanager.openwebconfiguration(webconfigpath);
configurationsection configsection=config.Getsection(”connectionstrings”);
configsection.sectionInformation.protectsection(”Dataprotectionconfigurationprovider”);
config.save();
}

How to decrypt connection string in asp.net stored in web.config.

Using System.web.configuration;
Protected void button_click(object sender,eventargs e)
{
string webconfigpath=”~”;
configuration config=webconfigurationmanager.openwebconfiguration(webconfigpath);
configurationsection configsection=config.Getsection(”connectionstrings”);
configsection.sectionInformation.Unprotectsection();
config.save();


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.