Session timeout: how to find out ?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Session timeout: how to find out ?

    Hi,

    While I am developing my app (DW MX 2004, ASP, VBSCript, SQLServer), I
    hit again and again a session timeout, because I code for a long while
    before refreshing my page. I virtually always get a message like this:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
    near '='.

    This is because I use session variables quite a bit in my DB accesses.

    Now, how can I elegantly detect that the session has timed out so that
    my future users won't see this ugly message, if they access a page, then
    have their coffee break without exiting the page, and just refresh it
    when coming back?

    This can happen of course at many different places in my app, i.e.
    whenever I use a session variable. I don't really fancy putting checking
    code in each and every of my DB accesses for finding empty values of the
    access attributes...

    What's your way of dealing with that problem (apart from declaring that
    the session should never expire...) ?

    And what should I show the users? They of course should login again, but
    how do I tell them?

    Thanks for your advice.

    Bernard
    bthouin Guest

  2. Similar Questions and Discussions

    1. #25116 [Com]: PHP can't find session, it starts the new session
      ID: 25116 Comment by: DiosV2 at AOL dot com Reported By: leo dot jokinen at laurea dot fi Status: Bogus Bug...
    2. #25116 [Fbk->Opn]: PHP can't find session, it starts the new session
      ID: 25116 User updated by: leo dot jokinen at laurea dot fi Reported By: leo dot jokinen at laurea dot fi -Status: ...
    3. #25116 [Bgs->Opn]: PHP can't find session, it starts the new session
      ID: 25116 User updated by: leo dot jokinen at laurea dot fi Reported By: leo dot jokinen at laurea dot fi -Status: ...
    4. #25116 [Opn->Fbk]: PHP can't find session, it starts the new session
      ID: 25116 Updated by: derick@php.net Reported By: leo dot jokinen at laurea dot fi -Status: Open +Status: ...
    5. #25116 [NEW]: PHP can't find session, it starts the new session
      From: leo dot jokinen at laurea dot fi Operating system: Windows XP home PHP version: 4.3.2 PHP Bug Type: Session related...
  3. #2

    Default Re: Session timeout: how to find out ?

    >>What's your way of dealing with that problem (apart from declaring that
    >>the session should never expire...) ?
    Whatever you do Don't try that :)
    >>And what should I show the users? They of course should login again, but
    >>how do I tell them?
    When working with Session variables or any other dynamic value it is always
    advisable to check the values are not empty before attempting to use them,
    especially when the data is destined for a database record.

    something like:
    If Session("Blah") <> "" Then
    'Do the DB insert/update
    Else
    'Redirect to a page telling the user the session has expired
    End If

    its best not to blindly do a DB insert without first checking the data to be
    inserted.

    --
    Kevin Marshall
    WebXeL.com Ltd
    [url]http://www.webxel.com[/url]

    ASP.NET Dreamweaver Extensions
    [url]http://www.webxel-dw.co.uk[/url]
    "bthouin" <bernard_thouin@bluewin.ch> wrote in message
    news:d1ei7a$ddu$1@forums.macromedia.com...
    > Hi,
    >
    > While I am developing my app (DW MX 2004, ASP, VBSCript, SQLServer), I hit
    > again and again a session timeout, because I code for a long while before
    > refreshing my page. I virtually always get a message like this:
    >
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
    > near '='.
    >
    > This is because I use session variables quite a bit in my DB accesses.
    >
    > Now, how can I elegantly detect that the session has timed out so that my
    > future users won't see this ugly message, if they access a page, then have
    > their coffee break without exiting the page, and just refresh it when
    > coming back?
    >
    > This can happen of course at many different places in my app, i.e.
    > whenever I use a session variable. I don't really fancy putting checking
    > code in each and every of my DB accesses for finding empty values of the
    > access attributes...
    >
    > What's your way of dealing with that problem (apart from declaring that
    > the session should never expire...) ?
    >
    > And what should I show the users? They of course should login again, but
    > how do I tell them?
    >
    > Thanks for your advice.
    >
    > Bernard

    Kevin Marshall Guest

  4. #3

    Default Re: Session timeout: how to find out ?

    You could specify the timout of the session variable to be whatever you like
    so that it won't timeout as often. If it needs to be shorter when users are
    accessing the system you could always do a site wide search and replace. Not
    very elegant but it would work.

    <% Session.timeout = 30 %>

    Then make a reporting page that will tell you if they are still valid or not
    (just an idea - not tested yet):

    <% If Session("EXAMPLE") <> "" then %>
    Session Example = <%=Session("EXAMPLE") %>

    Do this for each session so that when you access this reporting page a list
    of all current session variables will be displayed.

    "bthouin" <bernard_thouin@bluewin.ch> wrote in message
    news:d1ei7a$ddu$1@forums.macromedia.com...
    > Hi,
    >
    > While I am developing my app (DW MX 2004, ASP, VBSCript, SQLServer), I
    > hit again and again a session timeout, because I code for a long while
    > before refreshing my page. I virtually always get a message like this:
    >
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
    > near '='.
    >
    > This is because I use session variables quite a bit in my DB accesses.
    >
    > Now, how can I elegantly detect that the session has timed out so that
    > my future users won't see this ugly message, if they access a page, then
    > have their coffee break without exiting the page, and just refresh it
    > when coming back?
    >
    > This can happen of course at many different places in my app, i.e.
    > whenever I use a session variable. I don't really fancy putting checking
    > code in each and every of my DB accesses for finding empty values of the
    > access attributes...
    >
    > What's your way of dealing with that problem (apart from declaring that
    > the session should never expire...) ?
    >
    > And what should I show the users? They of course should login again, but
    > how do I tell them?
    >
    > Thanks for your advice.
    >
    > Bernard

    Mintyman Guest

  5. #4

    Default Re: Session timeout: how to find out ?

    i must confess i really hate fullfilling the app with conditional
    sentences to check if the sesion has timed out :-(

    some time ago i was playing around with Session_OnEnd() but couldn't
    find a reliable way to automatically detect session timeout. i can't
    believe that can't be done!

    Kevin Marshall wrote:
    > When working with Session variables or any other dynamic value it is always
    > advisable to check the values are not empty before attempting to use them,
    > especially when the data is destined for a database record.
    >
    > something like:
    > If Session("Blah") <> "" Then
    > 'Do the DB insert/update
    > Else
    > 'Redirect to a page telling the user the session has expired
    > End If
    >
    > its best not to blindly do a DB insert without first checking the data to be
    > inserted.
    Manuel Socarras Guest

  6. #5

    Default Re: Session timeout: how to find out ?

    Session_OnEnd() does work but it can't be used at page level, so there is no
    way to for example redirect the user when the session times out, when a
    session times out the server will simply create a new session and assign it
    to the user when they requests another page.

    The only reliable method I find is to check all values before blindly
    attemting to use them.

    --
    Kevin Marshall
    WebXeL.com Ltd
    [url]http://www.webxel.com[/url]

    ASP.NET Dreamweaver Extensions
    [url]http://www.webxel-dw.co.uk[/url]
    "Manuel Socarras" <msoc**no-spam**@airtel.net> wrote in message
    news:d1epj2$p9v$1@forums.macromedia.com...
    >i must confess i really hate fullfilling the app with conditional sentences
    >to check if the sesion has timed out :-(
    >
    > some time ago i was playing around with Session_OnEnd() but couldn't find
    > a reliable way to automatically detect session timeout. i can't believe
    > that can't be done!
    >
    > Kevin Marshall wrote:
    >
    >> When working with Session variables or any other dynamic value it is
    >> always advisable to check the values are not empty before attempting to
    >> use them, especially when the data is destined for a database record.
    >>
    >> something like:
    >> If Session("Blah") <> "" Then
    >> 'Do the DB insert/update
    >> Else
    >> 'Redirect to a page telling the user the session has expired
    >> End If
    >>
    >> its best not to blindly do a DB insert without first checking the data to
    >> be inserted.

    Kevin Marshall Guest

  7. #6

    Default Re: Session timeout: how to find out ?

    For Session_OnEnd() information, check out the global.asa information
    available on this forums archive at google, or on 4guys from rolla website
    ([url]http://www.4guysfromrolla.com[/url])

    HTH
    Rob
    [url]http://robgt.com[/url]


    RobGT Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139