Tuesday, January 18, 2011

Web Farm and Web Garden

Web garden in asp.net :
When an application is hosted by multiple processes on the same server it is said to be a web garden environment. An application pool with multiple worker process is called Web Garden, means single server and multiple CPUs.

All IIS Request process by worker process ( w3wp.exe), In web garden scenario If we use Session Mode to "in proc", our application will not work correctly because session will be handled by different Worker Process. For Avoid this Type of problem we should have to use Session Mode "out proc" and we can use "Session State Server" or "SQL-Server Session State".

Web farm means running one asp.net application on multiple machine.

Events in HTTPApplication in Asp.net

Here are the event occurred in life cycle of HTTPApplication

1. BeginRequest. The request processing starts.
2. AuthenticateRequest. The request is authenticated. IIS 7 and ASP.NET authentication modules subscribe to this stage to perform authentication.
3. PostAuthenticateRequest.
4. AuthorizeRequest. The request is authorized. IIS 7 and ASP.NET authorization modules check whether the authenticated user has access to the resource requested.
5. PostAuthorizeRequest.
6. ResolveRequestCache. Cache modules check whether the response to this request exists in the cache, and return it instead of proceeding with the rest of the execution path. Both ASP.NET Output Cache and IIS 7 Output Cache features execute.
7. PostResolveRequestCache.
8. MapRequestHandler. This stage is internal in ASP.NET and is used to determine the request handler.
9. PostMapRequestHandler.
10. AcquireRequestState. The state necessary for the request execution is retrieved. ASP.NET Session State and Profile modules obtain their data.
11. PostAcquireRequestState.
12. PreExecuteRequestHandler. Any tasks before the execution of the handler are performed.
13. ExecuteRequestHandler. The request handler executes. ASPX pages, ASP pages, CGI programs, and static files are served.
14. PostExecuteRequestHandler
15. ReleaseRequestState. The request state changes are saved, and the state is cleaned up here. ASP.NET Session State and Profile modules use this stage for cleanup.
16. PostReleaseRequestState.
17. UpdateRequestCache. The response is stored in the cache for future use. The ASP.NET Output Cache and IIS 7 Output Cache modules execute to save the response to their caches.
18. PostUpdateRequestCache.
19. LogRequest. This stage logs the results of the request, and is guaranteed to execute even if errors occur.
20. PostLogRequest.
21. EndRequest. This stage performs any final request cleanup, and is guaranteed to execute even if errors occur.

By using the familiar ASP.NET APIs, the ability to execute in the same stages as IIS 7 modules makes tasks that were only previously accessible in native ISAPI filters and extensions now possible in managed code.

Saturday, January 8, 2011

Scrum Agile Methodology

Scrum Agile Methodology is one of the most popular methodology in today’s software application development. We need to get familiar with few jargons while discussing about scrum.

1. Products Backlog : Product backlog will be created by Product Owner & scrum team. backlog are the piece of functionality of entire project.

2. Sprint backlog : Identifying the area will be developed in each mile stone.

3. Sprints : This is a small milestone. sprint can be of 7 to 30 days. and are a "timeboxed"

4. Scrum Master: who is monitoring the progress and updating prject plan day to day basis.

5. Burn down Charts :

6.Product Owner : Person who has the visualization of the product.

7. Scrum Team : Designer, Developer, Tester, Scrum master (project manager) & Project Owner.

8. Daily Scrum : Its a 30 minutes meeting with team members everyday in the morning to discuss the goal for the day.

9. Scrum Review : Once any sprint ends, everyone gets together in a meeting to share what he/she accomplished during the sprint, and what the problems come accross.

Now here i have found a great video, which can make you understand the scrum in just 10 minutes .

In addition there are two more thing good to know
1) Agile RFP - Request For Proposal
2) Agile RFI - Request for Information

Friday, January 7, 2011

Update records row by row using cursor in sql

How to loop through a table and update row by row using cursor in sql. ...basically looping through a table and updating record one by one in ms sql.

declare @cur1 cursor
declare @col1 varchar(10)
declare @col2 varchar(10)
declare @col3 varchar(10)
declare @col4 varchar(10)

set @cur1 = Cursor FOR SELECT column4,column1,column3 from myTable1

OPEN @cur1
FETCH NEXT FROM @cur1 into @col4, @col1, @col3
While @@FETCH_STATUS = 0
select @col2=column2 from differentTable2 where someColumn=@col3

if @col2 is not null
Update myTable1
set column2 = @col2
Where column4=@col4

FETCH NEXT FROM @cur1 into @col4, @col1, @col3
close cur1
deallocate cur1

Wednesday, January 5, 2011

Nhibernate Session Module Design

Session Module is the heart & head of nhibernate framework, so here i am publishing the design of SessionModule

Reference required :
using System;
using System.Web;
using NHibernate;
using NHibernate.Cfg;

Session Module class :
public class SessionModule : System.Web.IHttpModule
private static readonly string SESSION_KEY = "CONTEXT_SESSION";

private static NHibernate.ISession m_session;

private static ISessionFactory m_sessionFactory;

public void Dispose()


public void Init(System.Web.HttpApplication context)
context.BeginRequest += new EventHandler(BeginRequestHandlerExecute);
context.EndRequest += new EventHandler(EndRequestHandlerExecute);
// http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
Configuration cfg = new Configuration();
m_sessionFactory = cfg.BuildSessionFactory();


private void BeginRequestHandlerExecute(object sender, EventArgs e)
CurrentSession = m_sessionFactory.OpenSession() ;


private void EndRequestHandlerExecute(object sender, EventArgs e)
ISession currentSession = CurrentSession;
if (currentSession != null)

public static ISession CurrentSession
ISession session = (ISession)HttpContext.Current.Items[SESSION_KEY];
return session;
HttpContext.Current.Items[SESSION_KEY] = value;

public static ITransaction CurrentTransaction
ITransaction tran = (ITransaction)HttpContext.Current.Items[TRANSACTION_KEY];
return tran;
HttpContext.Current.Items[TRANSACTION_KEY] = value;

Monday, January 3, 2011

Nhibernate Quick Overview

Download all required nhibernate from following url.


How to use ICriteria ?

ICriteria criteria = SessionManager.CurrentSession.CreateCriteria();
criteria = criteria.Add(NHibernate.Criterion.Expression.Eq("StudentId", 48));
Student stu= criteria.UniqueResult();

How to Map two or more database table from one object in nhibernate ?

Suppose thhe following school object does not have a property called Student ,

public class School
public virtual ISet Students { get; set; }

Now in hbm you can map like

< set name="Students" table="Students" schema="oneSchool" cascade="all-delete-orphan" lazy="true" where ="AdminDate() between StartDate And IsNull(EndDate,GetDate())">
< key column="SchooldId" / >
< many-to-many class="Student" column="StudentId"/ >
< /set>

how to use transaction in Nhibernate ?

use Nhibernate.Transaction namespace reference;
using (ITransaction tran = SessionManager.CurrentSession.BeginTransaction())

ETG Consultancy

Web Designing Development Analysis & Promotion
Asp.Net 2.0 SQL WWF WCF SEO Marketing Ajax JQuery NHibernate MVC