how to track session time of user using Global.Asax? Watch

username1616429
Badges: 7
Rep:
?
#1
Report Thread starter 4 years ago
#1
am building a simple online quiz. When the user submits their details and pressed the ' start quiz button ', I want to be able to track how long it takes for them to do the quiz. I understand you use the global.asax file and add a session to the application start method.
When the user finishes the quiz they are then taken to a final page which tells them how long it took for them to complete the quiz.
I just want to know do how do I go about creating a timer to track the users time on the quiz. I know I have to minus the timer from the current time to get the total amount of time spent on the website. Do i need to use session states ?

timer global
0
reply
Async
Badges: 19
Rep:
?
#2
Report 4 years ago
#2
Why can't you just use a timer object? Or something of some sort.
0
reply
INTit
Badges: 17
Rep:
?
#3
Report 4 years ago
#3
You don't need a timer You just need the start time and the finish time. DateTime.Now

On the quiz start request set the session state to store the current time.On the completion request subtract the current time from the start time stored in session state.

That's assuming you wanted to use sessions and have a separate page for the start and end of the quiz.
0
reply
Async
Badges: 19
Rep:
?
#4
Report 4 years ago
#4
(Original post by INTit)
You don't need a timer You just need the start time and the finish time. DateTime.Now

On the quiz start request set the session state to store the current time.On the completion request subtract the current time from the start time stored in session state.

That's assuming you wanted to use sessions and have a separate page for the start and end of the quiz.
Good idea. I didn't even think of that

Posted from TSR Mobile
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

People at uni: do initiations (like heavy drinking) put you off joining sports societies?

Yes (370)
67.27%
No (180)
32.73%

Watched Threads

View All