Link to home
Start Free TrialLog in
Avatar of ysimon
ysimon

asked on

How can I use a global variable in multiple pages in IntraWeb for .NET?

I am using IntraWeb in a project of Delphi 2005 for.NET
I can not use a global variable between 2 pages. The methods for VCL applications can not be used here.
Is anyone using IntraWeb? Please help me, thanks,

ysimon
Avatar of aikimark
aikimark
Flag of United States of America image

alternatives to consider:
* store an encrypted hidden string between pages
* session variable -- I think .Net provides some native libraries for this
* cookies

Note: I'm a bit out of my league, since I don't have D2005/Intraweb experience.  I'm just suggesting work-arounds.
Avatar of ysimon
ysimon

ASKER

In normal IntraWeb Web Page project, there is a Session form we can used to set variables. However, there is no any such thing in IntraWeb for Delphi.NET

ysimon
but in a .NET application you can just use the Session state

Session['YourVariable']:=TheValue
or
Context.Session['YourVariable']:=TheValue

you need to include System.Web.SessionState in  your uses
Avatar of ysimon

ASKER

Hi BlackTigerX,

How do I define a variable type?
if a variable is defined in MainForm, can I use it in other web form?

ysimon
yes, as long as the types are compatible, you can use the same session variable in any number of forms

Context.Session['YourVariable']:=TheValue //TheValue can be string, int, a dataset, any object...

then in another form

AnotherVariableOfTheSameType:=Context.Session['YourVariable'];
Avatar of ysimon

ASKER

After I put
Context.Session['Num']:=123;
in the MainForm, I got
[Fatal Error] F2084 Internal Error: ILLK8154
when it was compiled
The left side is an Object, how can I input a value on it?

ysimon
Avatar of ysimon

ASKER

Any one know how to use Session to set global variables between the PageForms of IntraWeb for .NET?
Help!!!
ysimon
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial