Showing posts with label ASP.net How to. Show all posts
Showing posts with label ASP.net How to. Show all posts

Thursday, January 24, 2008

How to use the ASP.NET utility to encrypt credentials and session state connection strings

In your Asp.net applications, you might want to encrypt the impersonation userid & password. You can do this by using the tool provided by Microsoft and encrypt the userName and password attributes to be used with the section.

1. Download aspnet_setreg.exe from this location:
http://download.microsoft.com/download/2/9/8/29829651-e0f0-412e-92d0-e79da46fd7a5/aspnet_setreg.exe

2. ideally you can create a .bet file with the following command:
aspnet_setreg.exe -k:SOFTWARE\SECURE_APP\identity -u:"yourdomainname\username" -p:"password"

3. Then add an entry in your web.config to use this username & password for impersonation.



4. You need to also add necessary permissions so that the process can read this registry settings. else you will end up with the following error"

"Error reading configuration information from the registry"

You can read more on adding permission on the post "Error reading configuration information from the registry"

5. Restart IIS using iisreset on the command prompt.

Tuesday, January 22, 2008

How to use the ASP.NET utility to encrypt credentials and session state connection strings

In your Asp.net applications, you might want to encrypt the impersonation userid & password. You can do this by using the tool provided by Microsoft and encrypt the userName and password attributes to be used with the section.

1. Download aspnet_setreg.exe from this location:
http://download.microsoft.com/download/2/9/8/29829651-e0f0-412e-92d0-e79da46fd7a5/aspnet_setreg.exe

2. ideally you can create a .bet file with the following command:
aspnet_setreg.exe -k:SOFTWARE\SECURE_APP\identity -u:"yourdomainname\username" -p:"password"

3. Then add an entry in your web.config to use this username & password for impersonation.



4. You need to also add necessary permissions so that the process can read this registry settings. else you will end up with the following error"

"Error reading configuration information from the registry"

You can read more on adding permission on the post "Error reading configuration information from the registry"

5. Restart IIS using iisreset on the command prompt.

Thursday, October 12, 2006

Disable browser caching in ASP.NET - ASPdev.org

Removing caching from the ASP.net Page.

This is absolutely essential when using AJAX to retrieve time. if Cache for the AJAX page is not disabled, the page returns the same time for all requests.

Disable browser caching in ASP.NET - ASPdev.org: "Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers:

Response.Cache.SetCacheability(HttpCacheability.NoCache)"

Wednesday, August 23, 2006

USING ASP.net LOGIN CONTROL

Asp.net 2.0 provides a good login control. Instead of the developer coding his heads out on creating the login control, he / she can directly use the login control on the page and let ASP.net take care of the logistics.

To use the login control its important that you configure the database to store the credentials. On creating the website in ASP.net, you can click on the Web site menu and select the ASP.net configuration.

There is also other way of configuring the database using aspnet-regsql.exe tool from the visual studio command prompt.

After selecting the ASP.net configuration on Web site, the configuration of your web site starts on a browser. You will be able to configure the security which essentially enables you to set up and edit users, roles, and access permissions for your site, application configuration helps you manage your application's configuration settings and the provider configuration enables you to specify where and how to store administration data used by your Web site.

Select the Security configuration to open up the security configuration wizard which will guide you step by step to configure the settings. There are 7 steps involved to complete the activity.

Step 1: Welcome

Step 2: Select Access Method

Step 3: Data Store

Step 4: Define Roles

Step 5: Add New Users

Step 6: Add New Access Rules

Step 7: Complete

Click on the Next for Step 1. The second step asks you whether you want the application to use authentication using ‘Windows’ or ‘Forms’.

Selecting ‘INTERNET’ on this option will essentially enable the application to use its own login id and passwords. The third screen talks about the providers to use for data. The default provider for your application would be AspNetSqlProvider

You can use the default provider. Click Next on this screen to Define the roles for you application. This roles will be the roles that you want in the application. Next is the user definition screen where you would be able to add users to your application.