Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Scope of variables

$
0
0
Re: Scope of variables
Web Connection
Re: Scope of variables
04/22/2012
01:18:04 AM
3HH02SIYZ Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None

You don't have to do anything other than making sure you add:

FUNCTION OnProcessInit() this.InitSession() * .... any other code that needs to happen at start of every request

into your OnProcessInit() function. This gets the session object initialized for all requests and makes the Session object available.

I'm surprised that you've come this far and have not yet had a need to use the Session object...

+++ Rick ---



Ian,

Thanks. I read the help file sections (several times) and it looks like I can create a session, store data using sessionsetvar and retrieve it later with sessiongetvar.

What I could not figure out was where and how I get the wwsession started. Does it have to go in the WestWind program in c:\wconnect\... or in my code behind segments in c:\inetpub\wwwroot\...?

Potter


Potter... the place to keep user 'global' variables and their data is in the Session... look up the wwSession class in the Help file under Framework Support Classes... review the 'How It Works' topic... there is an explanation of how to utuilize this class... basically, the first time a user logs in and throughout the hit you can place 'global' variable/values in their session... then when they return you re-initialize these variable/values to 'maintain' their state for the logged in user... another way to maintain some state is to utilize a 'License Plate' methodology in the URL, though this is more involved... HTH...

I am still/again confused about this stateless nature of the Web application and in particular scope issues. When the user comes to my site, I force him to login with an e-mail address and password, look them up in a FoxPro table and determine what kind of access they should be allowed. How do I create memory variables or an object that will remain in scope in the various code behind programs throughout the users session? If I create a variable in the top-level Web connection executable, I presume it will remain in scope throughout, but will each individual visiting the website have their own set of these top-level variables?





Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii

Viewing all articles
Browse latest Browse all 10393

Trending Articles