State Management with ASP.NET 2.0 : Profile Feature

Wednesday, July 25, 2007

Its a common thing to have State Management in almost all the Web Applications, but use of this has always been a contentious issue. A developer has to decide whether the user data should be stored per session or should it persist across the sessions.

Using sessions states we can always very easily store the information temporarily. This typically works by assigning to each new user a unique session key that is used as an index for an in-memory data store and lasts only for the duration of the session.

What if you want to store data across the sessions? This is typically done by having a back end data store indexed by some user key. But again a question arises, what if you want to store data across sessions for anonymous users also? This is answered very well by the new Profile feature of ASP.NET 2.0.

Using this Profile feature, you can quickly build a web application that stores user information like user preferences or any other data into a database. Profile is similar to Session State but in one regard that it is persistent across the sessions. Profile feature has a strong link up with the ASP.NET membership system and this is why data for the authenticated users or clients is stored with their real identified instead of some arbitrary generated keys. For anonymous clients an identifier is generated for them and is stored as a persistent cookie, so that every time that same machine access the site the preferences or data for that client machine will be retained.

How you can use this Profile feature effectively and how to implement better state management using it is explained in this MSDN Magazine Article.

ASP.NET 2.0 : Web Deployment Projects - Website Model of Development

I always used to ask myself while creating a web project in Visual Studio 2003 with ASP.NET 1.1, that why the hell we need to install the IIS even though our aim is to just develop a web application and not to host it.

For all of those who used to think the same Microsoft came up with the Website Model of development with ASP.NET 2.0.

Now with ASP.NET 2.0 and Visual Studio 2005 instead of creating a new project inside Visual Studio, the Web site model lets you point to a directory and start writing pages and code. Not only this the built-in ASP.NET Development Server can be used to quickly test your site (even without installing IIS), which hosts ASP.NET in a local process and prevents the need to install IIS to begin developing.

This new website model enables us to develop our web application without thinking about packaging and deployment.

If your application is complete and you are ready to deploy, you have several options. The simplest choice is to copy your files to a live server and let everything be compiled on-demand (as it was in your test environment). The second option is to use the aspnet_compiler.exe utility and precompile the application into a binary release.

To know in details about these deployment techniques and more advanced concepts just go through this MSDN Magazine article by Fritz Onion

Fix Error : "Task Manager has been disabled by your administrator"

When you are trying to open the task manager by CTRL+ALT+DEL then are you getting the following dialog box saying "Task Manager has been disabled by your administrator".

Task Manager has been disabled by your administrator

There may be several reasons for this to happen.
1. You use account that was blocked via the "Local Group Policy" or "Domain Group Policy".
2. Some registry settings block you from using "Task Manager".
3. Your system has been infected by a Trojan that is blocking you to use you Task manager.

The thrird reason is the most dangerous one and the only solution for that is to update your Anti Virus Program, Scan your system and remove the Trojan.

How to fix the other issues we will discuss it here :

The best thing regarding this that i will recommend you all is to go through the following Microsoft support document and follow the procedures mentioned there: Microsoft Support

Other thing that i found out is a toll to fix the registry for the same. You can get the tool from here -> Registry Tool



2009 ·Techy Freak by TNB