Thursday, May 28, 2009

How to open .MBOX File

How to open MBOX File?

Gmail email format are in following format

Now, first time i come across .mbox extension, so how should i open file with .MBOX Extension.

Answer is: Word Pad

Resolveurl - Url Rewriting - Point to root directory

Resolve Url Path Problem, while working with Url Rewriting in

Whenever you are working with Url Rewriting, you might be interested in pointing to root directory for page been rewritten or for page which physically doesn't exist.

Url Rewritten Page:

This path doesn't exist and you are interested in finding physical path, so that you can able to point the available download with this article.

You can solve this problem with ResolveUrl() function.

ResolveUrl() Function can prove as angel to solve some of complex problem related to paths.

My earlier post had solve the problem in displaying image on master page, this can be helpful in case where you can't able to find solution with usual method.

Tuesday, May 26, 2009

Cost Cutting Chair - Funny + Interesting

Hello Friends,

Hope you guy's come across this email....  Isn't it funny and interesting....  Its really hilarious

COST Cutting Chair


Anyone of you have a  full version of a small song called "Ayo re Ayo re..." from Swadesh than please do share with me.

You can find small version of that song at 4:00 of this video.

I would be thankful to you, if anyone can share that video.

Download Latest version of Ajax Control Toolkit V3.0

Download Latest Version of AJAX Control Toolkit Version 3.0

Latest version of AJAX Control Toolkit V 3.0 includes

New controls

This release includes three important new controls:

  • HTMLEditor

    The HTMLEditor control allows you to easily create and edit HTML content. You can edit in design mode, as a rich text editor, or in source view to edit the HTML markup directly.

  • ComboBox

    The ComboBox control provides a DropDownList of items, combined with TextBox. Different modes determine the interplay between the text entry and the list of items.

    Many thanks to Dan Ludwig for building this.

  • ColorPicker

    The ColorPicker Control Extender can be attached to any ASP.NET TextBox control. It provides client-side color-picking functionality with UI in a popup control.

    Many thanks to Alexander Turlov for building this.

    Download AJAX Control Toolkit V3.0 to explore more controls

Videos for Visual Studio 2010 and .Net Framework 4.0 Features

Videos for Visual Studio 2010 and .Net Framework 4.0 Framework.

Download and Installation instruction for Visual Studio 2010
Visual Studio 2010 Beta 1 is here! In this episode of 10-4, Brian Keller takes us through downloading and installing Visual Studio 2010 Team Suite Beta 1 and Visual Studio 2010 Team Foundation Server Beta 1. This time-compressed video will take you through all of the key things you need to know to get up and running quickly with beta 1.

This video references several important URL's. Those URL's, as well as some other handy links for beta 1, are as follows:
Download instructions for all files in this video
More information about the Windows Server 2008 VHD
Beta 1 home on MSDN
Beta 1 forums
Visual Studio Connect site (report bugs / suggestions)
Common TFS 2010 Beta 1 Installation Problems
Visual Studio 2010 and .NET Framework 4 Training Kit

Core Coding Experience in Managed Languages

Visual Studio 2010 is an exciting release in managed languages and tools.  Visual C# and Visual Basic languages continue to evolve towards feature parity, strive to simplify programming and deployment with the Microsoft Office APIs, and allow easy interop to dynamic languages.  Visual F# is a new programming language which combines functional, object-oriented and explorative programming to provide a succinct, expressive and scalable language for .NET.  In the tools space, Visual Studio 2010 offers greater support for Test-Driven Development, where tests are written before product code as an iterative approach to software design.

Office Development in Visual Studio 2010

Visual Studio 2010 comes with improved Office Development functionality. You can now deploy multiple Office Solutions in one package which will appear as a single entry in the Add/Remove Programs in Windows XP or Programs and Features in Windows Vista. Visual Studio 2010 now also allows you to perform additional actions after the Office solution installation is complete such as copy documents or workbooks to the end user computer, create extra registry keys, or modify a configuration file.


The multi-targeting feature of Visual Studio lets you specify the version of the .NET Framework, or its profile, that is required for your application. The key benefit of multi-targeting is that you can use the current version of Visual Studio to create and develop projects that target earlier versions of the .NET Framework. For example, you can continue to develop projects that were created in Visual Studio 2008 without adding new .NET Framework dependencies.

Parallel Computing

The Parallel Extensions to the .NET Framework 4 and the Concurrency Runtime for Visual C++ 2010 enable developers to leverage parallel computing. By using these frameworks, developers can write parallel applications that will scale efficiently as the numbers of cores and processors increase. By avoiding the complexities of thread-focused programming models, the new parallel libraries simplify the production of parallel code and enable developers to more easily take advantage of parallel hardware. Visual Studio 2010 Beta 1 also provides new debugging and profiling tools to help developers understand and verify the behavior of their parallel applications.

Workflow Foundation

Workflow Foundation (WF) provides significant enhancements in this release such as explicit data model and fully declarative experience for authoring activities, a new Flowchart modeling style, deeper integration with Windows Communication Foundation (WCF) and high performance runtime engine.

Click here for more details

Wednesday, May 20, 2009

How to know Page.IsValid on Client Side in

How to know Page.IsValid on Client Side in

Generally you never run into this scenario, but it is important in case you are doing something which i tried to do.

I was trying to disable Submit button as soon as user press it, in order to avoid multiple button click.

What if error occurred, Validation control on client side will never call server-side function and so our button which was disable, will remain disable. To overcome, this problem, we need to identify whether Page is error free on client-side.

To find Page.IsValid on Client Side, simply check this on Disable Submit Button Javascript 

if (Page_IsValid)

Example:  Disable Submit Button Javascript Function
function DisableClickUploadArticle() {
var objName = 'btnUploadArticle';
if (Page_IsValid) {
document.getElementById(objName).disabled = true;
a = a + 1;
msg = 'Please Wait...(' + a + ')!';
document.getElementById(objName).value = msg;
var t = setTimeout('DisableClickUploadArticle()', 1000);
else {
document.getElementById(objName).disabled = false;
document.getElementById('PleaseWaitUploadArticle').style.display = 'none';
document.getElementById(objName).value = "Submit Article";

Monday, May 18, 2009

DropDownList Autopostback Problem with Chrome

I was trying to perform Autopostback on DropDownList, Selection and found that it was working in IE and Firefox, but not working in Chrome.

Cause of Problem
Required field Validator control is not working as expected for DropDownList Control

Solution to perform Page Postback on making selection to DropDownList
You need to set EnableClientScript="false" in order to make it work in Chrome.

<asp:DropDownList ID="ddlLanguage" runat="server" TabIndex="1" 
 ToolTip="Select Language" Width="190" AutoPostBack="true" 

<asp:RequiredFieldValidator ID="rfvLanguage" runat="server" EnableClientScript="false" ControlToValidate="ddlLanguage" InitialValue="0" TabIndex="1" Text="*" ErrorMessage="<b>Please Select Language</b>" Display="None"></asp:RequiredFieldValidator>

Sunday, May 17, 2009

Multiple Project in One Solution VS.Net - Enable Add New Project Option

Many times when you want to add Multiple Project in One Solution while working with different versions of VS.Net 2005, 2008... You find that solution is not shown, and that is the reason when you try to right click and "Add New Project" this option is not available.

Following is Solution for making Add New Project option available.  After enabling this option you would able to "Add New Projects" and thus create Multiple in Project in One solution.

Step 1: Select Tools menu in Visual Studio.

Step 2: Click on Options...

Step 3: Check "Show All Settings" at the bottom of popup-window

Step 4: Select "Projects and Solutions" from items available on left pane.

Step 5: Check "Always show solution" from right pane as shown in figure.

Friday, May 15, 2009

Space Used by Database and Table SQL Server Command

How to know how much space is consumed by your database.
Exec sp_spaceused 

database_name    database_size      unallocated space
------------------------------------------------ ---
Northwind             58.38 MB           8.23 MB

reserved           data               index_size         unused
------------------ ------------------ --------------
12056 KB           10464 KB           1104 KB            488 KB

How to know how much space is consumed by each table in your database
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

Well i cannot display output information but you can certainly try it SQL Analyzer and see the useful information about your database to control its size and remove unnecessary data.

Wednesday, May 13, 2009

A generic error occurred in GDI+ - Solution

Solution for Error: A generic error occurred in GDI+

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. 

Cause of Error: Trying to access invalid path or Trying to save image for path that doesn't exist.
Example:  I was trying to perform following

imgThumbnailImage = imgOriginalImage.GetThumbnailImage(width, height, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

imgThumbnailImage.Save(Server.MapPath(thumbnailImagePath), System.Drawing.Imaging.ImageFormat.Jpeg);

Wherein thumbnailImagePath will defer when you are trying to perform operation in sub directories.
i.e.  Directory Structure.
Web Application Root
 |----- ImageFolder
 |----- UserWork Folder
             |------ Tried to access ImageFolder which was in Root directory

Solution of Error: Try to access right directory path for image.  Now following path points to root directory where actual image exist.

imgThumbnailImage = imgOriginalImage.GetThumbnailImage(width, height, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

imgThumbnailImage.Save(Server.MapPath("..\\" + thumbnailImagePath), System.Drawing.Imaging.ImageFormat.Jpeg);

Tuesday, May 12, 2009

How to remove image from cache when Image is changed

How to remove image from cache when Image is changed.  If you are looking for How to Remove Cache Image from Client Browser than this post will be useful to you.

How Image Caching Starts
I was in search of Image Caching Technique which can load images which are comonly used in my application from cache, but should also support to display new image when it is replace.  
Example:  Images like Website Logo, Menu Images, and other commonly used images should be load from cache and so that user experience faster performance, but it should also be capable to display new image when changes is occur.  i.e. If user changes their user profile image, than it should display new image and invalidate old image on client browser.

To implement image caching in website which can perform above task i have implemented Image Caching Technique as mentioned in article

So after implementing it, i found that it will Cache the images and you have no control to invalidate cached image as it is stored on user browser, it can only be invalidated if user manually delete cache data, and it is certainly not in control of webmaster.

As first part works like charm (Caching commonly used images), so how should i remove cached image when user change his profile image or display most current image when cached image is changed.  Moreover my application has a dependency wherein name of image cannot be change on changing image.  i.e. User5.jpg is name of image, now whenever user changes his image, old image will be replaced with new image and will be stored with same name User5.jpg, but user browser has cached User5.jpg so how can i invalidate old image and instruct browser to display most current image.

This solution was provided by TechFriend on Forum Thanks Mate!

Solution to remove or invalidate image from cache which is stored on user browser

Whenever you are trying to save image append querystring to it and save in database

Example:  if your image name is User5.jpg append querystring like
"~/Image/User5.jpg?" + DateTime.Now.ToString("ddyyhhmmss")

Now whenever User5.jpg image is retrieved from database it has unique querystring append which changes everytime you change image, so if user images changed, its associated name of image will also change and browser will display the latest image, rather than displaying old image as browser identifies it as unique image, which is never cache by browser.

Now whenever you display the image like
<img src="~/Image/User5.jpg?" + DateTime.Now.ToString("ddyyhhmmss")>

It will always display latest image, wherein image name is retrieved from database, and good thing is it will display that image from cache until that image is changed.

Supplement to solution in case Thumbnail Image is generated.
What if you are generating Thumbnail based on above image?  It can be problem as their is no image with name "~/Image/User5.jpg?" + DateTime.Now.ToString("ddyyhhmmss") stored physically on server.

Rest of logic for generating thumbnail image will work good, you just need to add few lines more to perform extra care in our case.  lines which needs to be added is marked in bold.

//Take Original Image Path and Returns Thumbnail Image Path
private string GetThumbnailView(string OriginalImagePath, int height, int width)
    string ImgLastVersionNumber = string.Empty;
    if (OriginalImagePath.IndexOf("?") != -1)
        ImgLastVersionNumber = OriginalImagePath.Substring(OriginalImagePath.IndexOf("?"));
        OriginalImagePath = OriginalImagePath.Replace(ImgLastVersionNumber, string.Empty);

    //Consider Image is stored at path like "UserImage\\user9.jpg"
    //Now we have created one another folder UserThumbnail to store thumbnail image of User Image.
    //So let name of image be same, just change the foldername while storing image.
    string thumbnailImagePath = OriginalImagePath.Replace("UserImages", "UserThumbnail");

    //If thumbnail image is not available, generate it.
    if (!System.IO.File.Exists(Server.MapPath(thumbnailImagePath)))
        System.Drawing.Image imgThumbnailImage;

        System.Drawing.Image imgOriginalImage;
        if (!System.IO.File.Exists(Server.MapPath(OriginalImagePath)))
            imgOriginalImage = System.Drawing.Image.FromFile(Server.MapPath(clsGeneral.URLOfDefaultUserImage));
            imgOriginalImage = System.Drawing.Image.FromFile(Server.MapPath(OriginalImagePath));

        imgThumbnailImage = imgOriginalImage.GetThumbnailImage(width, height, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
        imgThumbnailImage.Save(Server.MapPath(thumbnailImagePath), System.Drawing.Imaging.ImageFormat.Jpeg);

        if (!System.IO.File.Exists(Server.MapPath(OriginalImagePath)))
            imgThumbnailImage.Save(Server.MapPath(OriginalImagePath), System.Drawing.Imaging.ImageFormat.Jpeg);

    return thumbnailImagePath + ImgLastVersionNumber;

Sunday, May 03, 2009

Image Caching in

If your application is using lot of images, and you want to speed up the load time of your website, than you should use Image caching technique in for avoiding extra bandwidth usage for getting same content and more over improve performance and enhance the user experience.

Image caching can be perform in either of following ways
  1. Image caching in IIS (Easy and fastest way, but you need access to IIS)
  2. Image caching with Custom HttpHandler in (Complicated way, yet useful when you don't have access to IIS, eg: while using third party web hosting)
Image caching article discus more on this topic and it is very useful.

Please click on Image Caching Article to read more on this topic.

Most Recent Post

Subscribe Blog via Email

Enter your email address:

Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape