Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with Session Class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
West Wind Web Connection
Divers
Thread ID:
00782249
Message ID:
00783027
Vues:
12
>
>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

*** Force the cookie to be added to header
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.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform