26/09/2011

CodeProjectScenario: In one of the projects, i got a situation where Half of the application is Migrated to MVC and other half is in Old 3 tier architecture.
Now, i have to host both the applications, and need to switch the context from one app to other with out intervening the user actions. We use to save all the user context and other information in sessions to maintain the state.
Bottom line is "I have to share the sessions between two different virtual directories in order to maintain the continuity of the application."

Resolution : After verifying couple of approaches, we found that Session can be shared by using a combination of Custom Http Module and SQL State management. We will see how to do that step by step.
Before going to Actual implementation, we need to see what are the tables used for SQL state management and their significance, thus we can understand how to make them work as we require.

Sql Server State Management: We know what are the different steps to do in order to configure SQL State management. Lets Open and see ASPState database. You will have 2 data tables.
#1. ASPStateTempApplications - This used to create a unique Appid for each in-comming application request based on the unique application name/ application ID.
#2. ASPStateTempSessions - This is used to create unique sessions for each user, correlated with each applicationid created in #1 table.

Logic: Now, from #1, you might have observed if you have 2 different applications, there will be 2 different application ids that will be created in table #1. So our duty is to restrict both the applications to create a single Appid, and this is acheived by using custom HTTP Module.

24/09/2011

In this post we will see the basic development secret of most of the Google's Doodles.
Try rotating your cursor around the monster image.
That is nothing but a combination of Images , style sheets, and JQuery.

We will see step by step how to develop one.

Step 1: Get a Sprite Image. (Not a soft drink).
It is a technology of displaying multiple images using a single image. See the below image for example.

This is a single image file containing 18 different images. I am going to use only first nine on the left.

18/09/2011

So clients send their request to the service and the service will receive them Via Endpoints. Thus the request will be processed.
Now, what if Service is down by the time client sends a request.
This is where Message Queuing (MSMQ) comes to picture to provide Message reliability.

This article will describe how to Create / Test one, by providing step by step description. Before we start anything, go to Programs in control panel, open "Turn on/off windows componenets". There enable all the services pertaining to MSMQ. Also ensure that all the services pertaing to Message Queuing are started in services section.

Step 1: Objective
I want to write a simple service (File Writer) which accepts user info from client and will write a log to a text file. And implement the message reliability using MSMQ.Step 2: Create Service Contract.
I defined a Interface for the file writer service. This interface is called "Contract", which will define the basic skeleton of the service.

How do you best structure the controller for moderate / complex Web applications so that you can achieve reuse and flexibility while avoiding code duplication?

MVC has been a tried and tested method of structuring your applications for a long time. Generally MVC mainly focuses on separating model and view and less attention on the controller. Specially in rich client applications the view and the controller tends to lie close together. But in web applications this separation is more critical since the view is essentially happening at client side (browser) while the most of the controller sits in the server side.
There are 2 basic ways of structuring the 'C' of the MVC, i.e Controller. The 2 basic methods are the Page Controller method and the Front Controller method.

For controllers that inherit from the ControllerBase class, the ControllerActionInvoker object that is associated with the controller determines which action method of the controller class to call, and then calls that method.