>
>loSession = CREATE("wwSession")
>lcCookie=REQUEST.GetCookie("wwUser")
>IF loSession.IsValidSession(lcCookie)
>Response.WRITE('valid ' + lcCookie)
> ELSE
>Response.WRITE('invalid')
>ENDIF
>
>Is there something wrong with this code?
Yes - you're not writing out the cookie. The Session doesn't automatically assign to a cookie. the session object is just the disk file manager. If you want the semi-automatic hander you have to use InitSession.
The easiest way to see whether this is working is to use the Status Form | Show Request Data. When you think you're generating a cookie check the generated HTML and you should see the cookie in the HTTP header.
Your code above could be written:
this.InitSession("wwuser")
Session = this.oSession
Response.ContentTypeHeader()
lcValue = Session.GetSessionVar("Value")
IF EMPTY(lcValue)
lcValue = SYS(2015)
Session.SessionVar("Value",lcValue)
lcValue = "New session value created: " + lcValue
ENDIF
Response.Write("Here's the Session Value:" + lcValue)
Nothing else is required.