Microsoft has released Visual Studio 2010 Service Pack 1 (SP1)

Microsoft has released long awaited service pack 1 for Visual Studio 2010. You can download this from here.

This Service Pack includes number of feature enhancements along with the bug fixes. Major enhancement for me is the HTML 5 support and IntelliTrace (formally known as Historical Debugger) for SharePoint.

Here are some of the major enhancements:-
  • Many Bug Fixes
  • Help Viewer 1.1
  • Sliverlight 4 Support
  • Basic Unit Testing support for the .NET Framework 3.5
  • Performance Wizard for Silverlight
  • IntelliTrace for 64-bit and SharePoint
  • Detecting mixed-mode installations
  • Software rendering (for Xp and Win2k3)

Web development
  • IIS Express support
  • SQL Server CE 4 support
  • Razor support (Introducing "Razor")
  • Web PI integration
  • Deployable dependencies
  • HTML5 and CSS3 support
  • WCF RIA Services V1 SP1 included

XAML Editor/Designer
  • Go To value definition
  • Style IntelliSense
  • Data source selector
  • Advanced grid commands
  • New Thickness Editor
  • Sample data support
  • Increased stability

  • MFC-based GPU-accelerated graphics and animations
  • New AMD and Intel instruction set support
  • Visual Basic Runtime embedding
For more details on above items visit Description of Visual Studio 2010 Service Pack 1. Also visit ScottGu's Blog for more details.

Also Microsoft has release Service Pack for TFS 2010. If you are using TFS then it is a must have for you. For further details you can go to Brian Harry's blog.

How to implement Cookieless Session in ASP. Net

By default ASP.Net relies on cookies to store session id. Cookies are actually a text data which is stored in browser. Generally cookies are not considered a safe way to store information. Also there is a chance that browser have disabled the cookies and in that case our application wont work on that browser.

To avoid such situation, we can use Cookieless session. To implement that you just need to set cookieless attribute to true in your session tag. Here is how you can do this:-
  <sessionState mode="InProc" cookieless="true" timeout="120" />

Once you have done that your URL will contain the session id, here is the snapshot of URL before and after implementing cookieless=true:-
As you can see that in the URL session id is visible.

Feel free to share your comments, Happy Codding !!!

How to Clear all elements from Cache

There are many situations when we want to clear contents of the cache in our ASP. Net application. Here is a quick and dirty way to remove all the contents from our cache.

        /// <summary>

        /// Clears all the data from Cache

        /// </summary>

        public void ClearCache()




                List<string> keyList = new List<string>();

                IDictionaryEnumerator CacheEnum = HttpContext.Current.Cache.GetEnumerator();

                string cacheKey;


                //Read all the keys from cache and store them in a list

                while (CacheEnum.MoveNext())


                    cacheKey = CacheEnum.Key.ToString();




                //Remove entries from cache

                foreach (string key in keyList)





                Response.Write("Cache Cleared");




                Response.Write("Cache NOT Cleared");



General I create a page name ClearCache.aspx and call above function in page_load method. So when ever I want to clear cache's contents I just call that page using URL.

Feel free to comment. Happy Coding !!!

Understanding Cache Sliding Expiration and Absolute Expiration

Asp .Net provides two different ways to expire the cache on the basis of time. Here are two aproaches:-
  1. Sliding Expiration
  2. Absolute Expiration 
1. Absolute Expiration
Absolute expiration means that your data will be removed from cache after fixed amount of time either it is accessed or not. Generally we use it when we are displaying data which is changing but we can afford to display outdated data in our pages.  Mostly I put all of my dropdown values in cache with Absolute Expiration. Here is how you can code:-
DataTable dt = GetDataFromDatabase();
Cache.Insert("AbsoluteCacheKey", dt, null,
DateTime.Now.AddMinutes(1), //Data will expire after 1 minute

2. Sliding Expiration
Sliding expiration means that your data will be removed from cache if that is not accessed for certain amount of time. Generally we store that data in this cache mode which is accessed many time on certain occasions. For example if you go in account settings section of a site, then you will be frequently accesing account information in that section. But most of the time you wont be using account setting's related data so there is no point of storing that data in cache. In such scenarios sliding expiration should be used. here is how you can save data in cache with sliding expiration:-

DataTable dt = GetDataFromDatabase();

Cache.Insert("SlidingExpiration", data, null,


TimeSpan.FromMinutes(1));//Data will be cached for 1 mins

Hopefully this information will be useful for you, feel free to share your feedback with me. Happy Coding !!!