Number of user count

Posted by Naga116 under C# on 7/31/2014 | Points: 10 | Views : 1149 | Status : [Member] | Replies : 1

One of the interviewer asked me below question

How we can get the number of user are accessing the web application? we should not change any code ?

I given the answer is Application object in Global.asax file

and he asked the Httphandler and HttpPipeline which one is the first event in page life cycle?

Please let me know



Posted by: Dotnet_EVIL on: 8/1/2014 [Member] Starter | Points: 25


To know the number of users accessing the website, we can simply write some code to the page_load event of the website's default.aspx page and with each new page load(checked by "IsPostBack"), we can save/add value of "1" to the database and when we check the database we can see the number of visits made on the website.
This process will not show unique visit to the website, so to make the unique visit, we need to make few more things, like: we can save a cookie to the browser's computer and on each page_load event we can check if the browser is having that cookie which we save, if not, then this visit will be as an unique visit else this visit is not an unique visit.

Regarding the "Httphandler and HttpPipeline", First of all, it is not HttpPipeline, it is HttpModule which is called part of the ASP.Net request pipeline.

When a request is made on our ASP.Net website, that request is carried forward with the HttpRequest object and then it reaches to the HttpModule(part of ASP.Net request pipeline), now HttpModule checks this request and decides this particular request should be proceed by whom(HttpHandler)? And then it(HttpModule) sends this request to the HttpHandler who can handle this request can produce a output.

So definitely, HttpModules(ASP.Net request pipeline) comes first, then HttpHandlers.


Naga116, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response