Results 1 to 9 of 9

Thread: Session Variables to Restrict Access to Page

  1. #1
    Join Date
    Jul 2005
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Session Variables to Restrict Access to Page

    Hi
    I use session variables to restrict access to pages where I want to restrict access to secure data. However, these do not last very long and the session variable is lost - often within 15 minutes - and this causes problems when doing updates to data online. I think the variable is lost due to the frequency that the server is reset - but it happens quite frequently

    Does anybody else have same problem? Any ideas of how to overcome this? Problem is I have many pages that have the code to restrict access ( code produced via Dreamweaver 4 )
    Cheers
    Ian

  2. #2
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    A typical session will expire 15-20 minutes after the last activity; however since the shared web servers are recycled frequently to keep them running well no session will last longer than 45 minutes and may even only last a few minutes if the session is created moments before a due recycle.

    Some other session state storage method is recommended, or at least something to support the loss of a session to reestablish it.

    This issue does not apply to our Premier service, where customers have the control over the recycling frequency.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  3. #3
    Join Date
    Oct 2005
    Location
    Scotland
    Posts
    229
    Thanks
    7
    Thanked 12 Times in 8 Posts

    Default

    If it's asp or asp.net you can use SQL Server to store session data.

  4. #4
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    Storing such information in session is ok but is limited to how long a session lasts. In ASP and ASP.NET you can configure the duration of the session but the longer the time more memory is consumed.

    I did not relise that the servers are recycled every 45 minutes as this could be a pain if you were trying to build an ecom site where you stored a customers basket id within the session as it could be lost if the server is recycled the next minute - the customer would not understand why the contents of their basket had been lost - and would shop elsewhere.

    This means you will have to store a cookie on the customers computer and use this to identify the user and store any session related data in the database - this is not ideal as users are more likely to block cookies compared to session cookies.

    Alternative is go for premium hosting.

    James

  5. #5
    Join Date
    Oct 2005
    Posts
    98
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I was looking at this because I was writing as Ajax Chat room to run on my site and had the same problem, I ended up using a different solution but while researching I found this page which has a great SQL based option that uses unique strings to track a users details.

    http://www.4guysfromrolla.com/webtech/041600-2.shtml

    It has all the required code on pages 2 and 3 to code a system to track a user as long as they are using the same IP within a given period of time.

  6. #6
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Quote Originally Posted by jimlewis View Post
    This means you will have to store a cookie on the customers computer and use this to identify the user and store any session related data in the database
    Not necessarily, you could store session state in a database or flat files (like PHP) for example - this only applies to (albeit most common) in-process session storage.

    ASP.NET has native support for database session state storage and out-of-process state server storage (which we support); and its relatively easy to support other methods of session storage in ASP.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  7. #7
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    Quote Originally Posted by Warren Ashcroft View Post
    Not necessarily, you could store session state in a database or flat files (like PHP) for example - this only applies to (albeit most common) in-process session storage.

    ASP.NET has native support for database session state storage and out-of-process state server storage (which we support); and its relatively easy to support other methods of session storage in ASP.
    Hi Warren,

    At work we store session state in SQL server database to allow load balancing. Such solution still requires a session cookie on the client to identify the user with the data held in the database. If the users session is terminated they will loose their session data. Therefore you would need to work round this using a more permanent cookie or put session identifier in URL - both solutions are not ideal.

    James

  8. #8
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    Quote Originally Posted by Interlogic View Post
    I was looking at this because I was writing as Ajax Chat room to run on my site and had the same problem, I ended up using a different solution but while researching I found this page which has a great SQL based option that uses unique strings to track a users details.

    http://www.4guysfromrolla.com/webtech/041600-2.shtml

    It has all the required code on pages 2 and 3 to code a system to track a user as long as they are using the same IP within a given period of time.
    If I am correct the user identifier is placed in the URL - this is a real killer for SEO - ePages does this

    http://www.optomarket.com/epages/Opt...5b/Catalog/009

  9. #9
    Join Date
    Feb 2004
    Posts
    4,903
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Quote Originally Posted by jimlewis View Post
    Hi Warren,

    At work we store session state in SQL server database to allow load balancing. Such solution still requires a session cookie on the client to identify the user with the data held in the database. If the users session is terminated they will loose their session data. Therefore you would need to work round this using a more permanent cookie or put session identifier in URL - both solutions are not ideal.

    James
    Any session storage solution, including the defaults in ASP and ASP.NET HAVE to use cookies to track who owns what sessions - there is no way around this other than an ID in the URL like you mentioned which I believe ASP.NET supports to some extent.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Health Education, Question & Answer Session
    By Warren Ashcroft in forum Jokes and Stories
    Replies: 0
    Last Post: 23rd February 2006, 02:48 AM
  2. Asp.net session timeout
    By kbi911 in forum ASP.NET
    Replies: 3
    Last Post: 14th February 2006, 01:39 PM
  3. index page
    By olearydc in forum Technical Support
    Replies: 3
    Last Post: 24th August 2005, 02:19 AM
  4. session variables and https
    By holivar in forum Development Support
    Replies: 2
    Last Post: 1st July 2005, 02:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •