473,625 Members | 3,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding out the time user takes before hitting submit

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 18 '05 #1
3 1153
On 26 Apr 2004 16:36:32 -0700, as*******@hotma il.com (Asad) wrote:
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.


Your point of server / client side is good and would lead me to do the
timing on the client side. If you are testing how long a user is
looking at a page, it would be unfair to count the download and
tranfer times. Using Javascript, set a variable on pageload and on
submit, determine the time between now and the saved time. Pass that
value back to the server for processing and recording.

Nov 18 '05 #2
Hi Asad,

If you want to do it on the server-side, you could set the time when the
page loads and store it in a viewstate. Then, when the postback happens (the
user clicked the button), you can calculate the time of the postback minus
the original time. All this is done in a TimeSpan.

Here's the idea:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
If Not IsPostBack Then
viewstate("star ttime") = Now
Else
Dim tmspan As TimeSpan
tmspan = Date.Now.Subtra ct _
(CType(viewstat e("starttime" ), DateTime))
Label1.Text = tmspan.TotalSec onds.ToString
End If
End Sub

<form id="Form1" method="post" runat="server">
<P>
<asp:Label id="Label1" runat="server"> Label</asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

"Asad" <as*******@hotm ail.com> wrote in message
news:fd******** *************** ***@posting.goo gle.com...
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 18 '05 #3
One way to do it in concept (code not sure)

have a hidden input box on the form.

on the onload event fire some javascript that updates this input box each
second.

then when the form is submitted you simply check the value in that box.

"Asad" <as*******@hotm ail.com> wrote in message
news:fd******** *************** ***@posting.goo gle.com...
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 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4376
by: Christine | last post by:
I've implemented a countdown timer for a tutorial web page that should give the user 45 minutes to complete the test, only to find that the timer is slowly 'losing' time. On average, it actually takes an extra 35 seconds, but has taken an extra 2.5 minutes in some cases. Any ideas what might be the cause? And more importantly - the fix? Code snippet below... Thanks, Christine
4
9502
by: James Bond 007 | last post by:
I am a novice to Javascript (can do simple text-based pop-ups, but not familiar with variable manipulation). I would like to have a Javascript that gives me the start time (I don't care about the date) when the user entered my webpage and then the time that the user hit the "Submit" button on my HTML form.
2
3110
by: 23s | last post by:
My site's login page has a form w/ 2 textboxes and a submit button. If I'm in either of those textboxes (i.e., either one of the textboxes has focus), in any given browser, hitting "enter" on my keyboard submits the form. Server side, I handle the click event of the submit button. This is the expected behavior, and this is the behavior irrespective of what browser I use on the login page. However... I have different page that is an...
1
1134
by: Asad | last post by:
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
1
1085
by: Michael E. O. Borchert | last post by:
I'm having a very isolated problem using with (I believe) windows integrated security on a site on a corporate intranet, unfortunately the one person who is running into the problem is the main person who needs to use the app. When this one user (I have tried three others) clicks a "submit" button, the server thinks for awhile (30-45 seconds), and then prompts her for her username and password. Both fields are auto-filled, but the username...
4
1415
by: prashanth | last post by:
we have a Asp.net application which is used to generate the reports. In this application there are some reports which takes more than 50 minutes of the time.these reports works fine on development PC Win2k professional with IIS5.0 but These report which takes longer duration does not work on the Production System 2003 server with IIS6.0. but the log entries that are written at the server states that the process is completed. but the user...
2
2893
by: Kevin Frey | last post by:
Hello, I've been reading that ASP.NET serialises (ie. processes one at a time) HTTP requests if two simultaneous requests need to access the same session state. It also makes note that ASP.NET tries to reacquire a lock on the session state every 1/2 second until the timeout is reached, and then it will forcibly release the previous users lock and take the lock for itself. What is this timeout figure?
1
1935
by: William Sullivan | last post by:
I've got a website that may, on occasion, display a large list of items in a bulletedlist control. On the client side, it takes about 4 seconds to get a response that weighs in at over 1mb. It takes less than a second to display those nodes. That part is fine The problem is that when the user causes a postback, the browser appears to lock up for anywhere between 10-20 seconds, at which point it renders the response from the server. ...
23
3216
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.