Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 135,958 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,607 people online right now. Registration is fast and FREE... Join Now!




capturing user login and logout time

3 Pages V  1 2 3 >  
Reply to this topicStart new topic

capturing user login and logout time

devanshi15
9 May, 2008 - 04:02 AM
Post #1

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

hi all...
m working on an attendence based project...i want that at the login button's click it must capture time from the system and same at logout. i m interested in using sessions but dnt have any idea how to use them...my login page has just the employeeid and password labels and a login button. and the logout page have the employeeid and the intime captured at the login.....please help me its urgent....i have to report within 5 days..plsssssssssss provide me with the prioper code for that.....



thanks in advnce



User is offlineProfile CardPM
+Quote Post

zakary
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:07 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
string time = System.DateTime.Now;

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this: [code] place code here... [b][/code][b/]

This post has been edited by zakary: 9 May, 2008 - 04:08 AM
User is offlineProfile CardPM
+Quote Post

skater_00
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:09 AM
Post #3

D.I.C Head
Group Icon

Joined: 30 Apr, 2008
Posts: 173



Thanked: 4 times
Dream Kudos: 50
My Contributions
Obviously you are quite unable to read red highlighted text that often shows up on certain forums before people submit their post.
User is offlineProfile CardPM
+Quote Post

devanshi15
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:19 AM
Post #4

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

hi...
i told u before i have no clue working on sessions...i came up to you as a last hope...and i want to use sessions for that....plsss help me out plssss...m in great mess...
User is offlineProfile CardPM
+Quote Post

zakary
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:27 AM
Post #5

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
google it

this what i got
http://www.experts-exchange.com/Programmin...Q_23241744.html
User is offlineProfile CardPM
+Quote Post

devanshi15
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:37 AM
Post #6

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

hi zakary...
thanks for ur help dear....please guide me step by step how and where to use this whole code...
m really in need....have no idea about this idea....

thanks..
User is offlineProfile CardPM
+Quote Post

zakary
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:48 AM
Post #7

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
I really don't know much about session because that is C# .NET (web base) development. I am a software guy, but google is a developers best friend.

Check out this Tutorial on sessions
http://www.dreamincode.net/forums/showtopic45300.htm
User is offlineProfile CardPM
+Quote Post

devanshi15
RE: Capturing User Login And Logout Time
9 May, 2008 - 04:59 AM
Post #8

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

but i really need help...pls find it out..plsss.....try n understand my problem....its kindda urgent...my boss is gonna throw me up...plsssss
User is offlineProfile CardPM
+Quote Post

zakary
RE: Capturing User Login And Logout Time
9 May, 2008 - 05:12 AM
Post #9

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
Sorry good luck finding a new job as i posted before

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this: [code] place code here... [/code]
User is offlineProfile CardPM
+Quote Post

devanshi15
RE: Capturing User Login And Logout Time
12 May, 2008 - 09:03 PM
Post #10

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

well i worked on it and found out the solution below...
//this is written behind the global.asax file
CODE

void Session_Start(object sender, EventArgs e)
    {
        Session["StrSessionStart"];
        Session["strSessionEnd"];
    }

//this is written behind the login button

Session["StrSesssionStart"] = txtStartSessionDate.Text;
        string strSessionStart = txtStartSessionDate.Text + " " + txtStartSessionTime.Text;
        DateTime testdate = DateTime.ParseExact(strSessionStart, "M/d/yyyy H:mm tt", null);
        Session.DateSessionStart = testdate;

//this is written behind the logout button.
protected void Button1_Click(object sender, EventArgs e)
    {
        string strSessionEnd = txtStartSessionDate.Text + " " + txtEndSessionTime.Text;
        Session.DateSessionEnd = DateTime.ParseExact(strSessionEnd, "M/d/yyyy H:mm ", null);

    }

but the error is... it doesnt recognise Session in the global.asax file. it says only call,assignment,increment,decrement can be used as a statement...


i hope to get some help from u guys now..


thanks
User is offlineProfile CardPM
+Quote Post

devanshi15
RE: Capturing User Login And Logout Time
12 May, 2008 - 10:05 PM
Post #11

New D.I.C Head
*

Joined: 9 May, 2008
Posts: 15

plss guys help me solve my problem....


Thanks
User is offlineProfile CardPM
+Quote Post

zakary
RE: Capturing User Login And Logout Time
13 May, 2008 - 04:49 AM
Post #12

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
make sure you add the .Net References System.Web to your application then all
using System.Web;
using System.Web.SessionState;
to your class
User is offlineProfile CardPM
+Quote Post

3 Pages V  1 2 3 >
Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 09:20AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month