शेखर
शेखर

Reputation: 17604

How to find the time of request for a page at server

I am writing a code to find the time when any page is requested by the browser.
And when the response send by the server.
I have looped through Request collection using following


    foreach (string s in Request.Params.Keys)
    {
       Response.Write(s + ":" + Request.Params[s]);
    }

But I am not getting any variable for this purpose.
Is there any other way.

Upvotes: 0

Views: 373

Answers (1)

Royi Namir
Royi Namir

Reputation: 148744

you should use the httpModule events - pipline methods - ehich can be accessed via global.asax file.:

Application_BeginRequest

Occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request.

Application_EndRequest

Occurs as the last event in the HTTP pipeline chain of execution when ASP.NET responds to a request.

there , you can check DateTime.Now.

edit

if you want to know when the person requested the page ( via link or something - not the GO button) -

you can set a hiddenField which will have the getDate() in JS.

this element will be sent to the server as a part of form inputs.

Upvotes: 1

Related Questions