By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,996 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,996 IT Pros & Developers. It's quick & easy.

Time user takes before hitting submit

P: n/a
Hi,

I was wondering how I can find out the time user takes on an aspx page
before hitting a submit button. Since there is that whole server-side
vs. client-side issue, I was thinking I can store the current time in
a variable on server side, and when the user hits submit, inside the
method invoked I take the difference of the time now and the
previously stored time.

It all makes sense right? And I'm new with ASP.NET coding, so I'd
appreciate if someone can show me a little bit of code so I know which
libraries to use and the syntax.

Thank you in advance.

Asad
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On form_Load.....

If Not Page.IsPostBack Then

Session("CurrentTime") = DateTime.Now
Else
If Not Session("CurrentTime") is Nothing then

'Now you can subract CType(Session("CurrentTime", DateTime)) from
DateTime.Now to get your value. Use a Timespan or whatever date function
you want. DateTime.Now will give you the current time,
Session("CurrentTime") [use Ctype to cast it to a datetime] will give you
the value the page was loaded or refreshed but not if it was loaded via a
postback.
End If
End If
"Asad" <as*******@hotmail.com> wrote in message
news:fd**************************@posting.google.c om...
Hi,

I was wondering how I can find out the time user takes on an aspx page
before hitting a submit button. Since there is that whole server-side
vs. client-side issue, I was thinking I can store the current time in
a variable on server side, and when the user hits submit, inside the
method invoked I take the difference of the time now and the
previously stored time.

It all makes sense right? And I'm new with ASP.NET coding, so I'd
appreciate if someone can show me a little bit of code so I know which
libraries to use and the syntax.

Thank you in advance.

Asad

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.