Ask a Question related to ASP, Design and Development.

  1. #1

    Default session is nothing

    How can I know if a user session had timed out ?

    I always get an error in my asp page when I try to access
    my session variable if it timed out.

    Thank You.
    Joel Brabant Guest

  2. Similar Questions and Discussions

    1. #16263 [Com]: session.start() create new empty session file and not resume existing session
      ID: 16263 Comment by: pat at burnttech dot com Reported By: kur at natur dot cuni dot cz Status: No Feedback...
    2. #25307 [Ver->Csd]: Crash when session.serialize_handler=wddx & session, post, get vars
      ID: 25307 Updated by: sniper@php.net Reported By: cristea at pntcd dot ro -Status: Verified +Status: ...
    3. #25307 [Ver]: Crash when session.serialize_handler=wddx & session, post, get vars
      ID: 25307 User updated by: cristea at pntcd dot ro Reported By: cristea at pntcd dot ro Status: Verified Bug Type: ...
    4. #25307 [NEW]: Crash when session.serialize_handler=wddx & session, post, get vars
      From: cristea at pntcd dot ro Operating system: any PHP version: 4CVS-2003-08-29 (stable) PHP Bug Type: Session related Bug...
  3. #2

    Default Re: session is nothing

    What error? What code? Any time you hit your asp page, there's a session,
    whether it's the same one that you had five seconds prior, or a new one.

    Ray at work

    "Joel Brabant" <joel.brabant@tembec.com> wrote in message
    news:085701c3940e$57098300$a001280a@phx.gbl...
    > How can I know if a user session had timed out ?
    >
    > I always get an error in my asp page when I try to access
    > my session variable if it timed out.
    >
    > Thank You.

    Ray at Guest

  4. #3

    Default Re: session is nothing

    define "try to access" !

    "Joel Brabant" <joel.brabant@tembec.com> wrote in message
    news:085701c3940e$57098300$a001280a@phx.gbl...
    > How can I know if a user session had timed out ?
    >
    > I always get an error in my asp page when I try to access
    > my session variable if it timed out.
    >
    > Thank You.

    Mike Florio Guest

  5. #4

    Default Re: session is nothing

    The error is : object required....

    The session has timed out.
    For sure my session("blabla") is nothing... I know that.

    But howcome it crashes when I use

    If session("blabla") is nothing then
    ...
    end if

    !!!

    Joel Brabant
    Developer
    Tembec Inc.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Joel Brabant Guest

  6. #5

    Default Re: session is nothing

    Are you storing OBJECTS in session variables?

    Ray at work

    "Joel Brabant" <joel.brabant@tembec.com> wrote in message
    news:emhrMPBlDHA.2140@TK2MSFTNGP09.phx.gbl...
    > The error is : object required....
    >
    > The session has timed out.
    > For sure my session("blabla") is nothing... I know that.
    >
    > But howcome it crashes when I use
    >
    > If session("blabla") is nothing then
    > ..
    > end if
    >
    > !!!
    >
    > Joel Brabant
    > Developer
    > Tembec Inc.
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  7. #6

    Default Re: session is nothing

    "is" is not a keyword. Why don't you post the code so that we can really
    help you ;->


    "Joel Brabant" <joel.brabant@tembec.com> wrote in message
    news:emhrMPBlDHA.2140@TK2MSFTNGP09.phx.gbl...
    > The error is : object required....
    >
    > The session has timed out.
    > For sure my session("blabla") is nothing... I know that.
    >
    > But howcome it crashes when I use
    >
    > If session("blabla") is nothing then
    > ..
    > end if
    >
    > !!!
    >
    > Joel Brabant
    > Developer
    > Tembec Inc.
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Mike Florio Guest

  8. #7

    Default Re: session is nothing

    P.S. Is Nothing only works on variables that have been defined as object
    variables. i.e.

    On Error Resume Next
    Dim x
    response.write "x is nothing?<br>"
    Response.Write x is nothing
    response.write "<br>" & err.description
    err.clear
    response.write "<hr>"


    set x = createobject("adodb.connection")
    response.write "x is now an object<br>"
    response.write x is nothing
    response.write err.description & "<br>"
    err.clear
    response.write "<hr>"


    response.write "x has been destroyed<br>"
    set x = nothing
    response.write x is nothing
    response.write err.description


    If this were VB code and you did:
    dim x as object

    It wouldn't generate the error.

    Ray at work




    ''that will gen
    "Joel Brabant" <joel.brabant@tembec.com> wrote in message
    news:emhrMPBlDHA.2140@TK2MSFTNGP09.phx.gbl...
    > The error is : object required....
    >
    > The session has timed out.
    > For sure my session("blabla") is nothing... I know that.
    >
    > But howcome it crashes when I use
    >
    > If session("blabla") is nothing then
    > ..
    > end if
    >
    > !!!
    >
    > Joel Brabant
    > Developer
    > Tembec Inc.
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  9. #8

    Default Re: session is nothing

    Joel Brabant wrote:
    > The error is : object required....
    >
    > The session has timed out.
    > For sure my session("blabla") is nothing... I know that.
    >
    > But howcome it crashes when I use
    >
    > If session("blabla") is nothing then
    > ..
    Because, unless you are storing an object in session("blabla"),
    session("blabla") will not be an object. Only objects can be Nothing.

    I usually do this:

    If len(session("blabla")) = 0 then

    --
    HTH,
    Bob Barrows - Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

  10. #9

    Default Re: session is nothing

    Session("oAppUser") is in fact an object that was returned by my vb code
    like this:

    Set oAppTDE = Server.CreateObject("AppTDE.TDEManager")
    Set Session("oAppUser")=oAppTDE.Login(cstr(sUsername), cstr(sPassword))
    Set oAppTDE = Nothing

    Don't worry ! I know, we are not suppose to store objects in session
    variables....but that object has just a couple of properties that's it.

    Thank you all for your help.

    Joel Brabant
    Developer
    Tembec Inc.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Joel Brabant Guest

  11. #10

    Default Re: session is nothing


    Joel Brabant wrote:
    > Session("oAppUser") is in fact an object that was returned by my vb
    > code like this:
    >
    > Set oAppTDE = Server.CreateObject("AppTDE.TDEManager")
    > Set Session("oAppUser")=oAppTDE.Login(cstr(sUsername), cstr(sPassword))
    > Set oAppTDE = Nothing
    >
    > Don't worry ! I know, we are not suppose to store objects in session
    > variables....but that object has just a couple of properties that's
    > it.
    >
    What the object stores is not the problem. The problem is whether or not the
    object is free-threaded. If it was created in VB, then it is not
    free-threaded, and storing it in Session is not recommended.

    So, you need to find out if the session variable exists, and if it does
    exist, it will contain an object.

    The first step is to use IsObject to determine if it is an object.

    If IsObject(Session("oAppUser") then
    if not Session("oAppUser") is nothing then


    --
    HTH,
    Bob Barrows - Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows 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