1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

asp use session to keep User login

Discussion in 'C#' started by qq2, Jun 23, 2009.

  1. #1
    Hi, i need some help on my asp project

    the user login, i use session to keep ur pwd, and the user name is passing with the url. so everytime i'll check the session("pwd") ,if empty,then back to login page. so can protect that user save the url and enter in without key in password.

    but i feel it's quite trouble. the session will be clear after some duration.is there anyway to refresh it everytime?
    or please teach me the best way for asp to doing the user login tracking. thanks a lot.
     
    qq2, Jun 23, 2009 IP
  2. dopanel.com

    dopanel.com Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cookies & Session
    I usually used Session to keep the status.If visitor don't have any activity in 20 minutes ,then the session will empty by IIS.
    Cookies is saved in visitor's computer. It also will expire if visitor don't have any activity in some time.

    The expire time of session & cookies can be config in your asp script.
     
    dopanel.com, Jun 24, 2009 IP
  3. DoDo Me

    DoDo Me Peon

    Messages:
    2,257
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #3
    don't use session, waste memory, lower server performance and limited your code in one server, you cannot have server load balance on session

    use cookie instead. save a key in cookie based on user(IP), username and saved in database as well, every time do a recalculation for authorization
     
    DoDo Me, Jun 24, 2009 IP
  4. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #4
    Load balancing systems support sticky-IP based sessions. Also, I agree that session-based state management is not ideal. If you MUST use the session, keep it lite and use a session wrapper class to limit the number of items.
     
    Social.Network, Jun 24, 2009 IP
  5. paulv200

    paulv200 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Cookie log in has more possiblilities as you can do things like allowing the user to automatically log in, however, I always use sessions and have had no real issues with it.
     
    paulv200, Jun 27, 2009 IP
  6. rahulwb

    rahulwb Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    r u using ASP or ASP.NET?
     
    rahulwb, Jul 2, 2009 IP
  7. qq2

    qq2 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    sorry for not online for long time. cause suddenly switch to another project. thanks for all of u's reply.i'm working on ASP. now i used session for it. cause it's faster way for me right now.it's for company information tracking site. customer don't want remember me function. so think cookies is not suitable. .any way. thanks for all of you...
     
    qq2, Jul 5, 2009 IP
  8. selinangela

    selinangela Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Cookie log in has more possiblilities as you can do things like allowing the user to automatically log in, however, I always use sessions and have had no real issues with it.
     
    selinangela, Jul 10, 2009 IP