473,792 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session variable in a module....

When I use a session variable in a module, it says "Name session is not
declared". Is it not possible to use session variable in module?

Wilson


Nov 18 '05 #1
3 4545
"WilsonSmit h" <WS********@hot mail.com> wrote in message
news:eQ******** *****@TK2MSFTNG P11.phx.gbl...
When I use a session variable in a module, it says "Name session is not
declared". Is it not possible to use session variable in module?


Here's a quiz for you:

1) In a page, why (and how) is "Session" defined?
2) In what way does that differ from a module?

--
John Saunders
johnwsaundersii i at hotmail
Answers:

1) In a page (or user control), the name "Session" refers to "this.Sessi on"
(or Me.Session in VB.NET). This is the same as Context.Session , which means
this.Context.Se ssion.
2) Anywhere else, "Session" is undefined unless you define it. However, you
can get access to the same value by referring to
System.Web.Http Context.Current .Session.
Nov 18 '05 #2
Tee
When you want to use session but you are not in an aspx page or ascx ( web
user control ), you need to use the code
httpcontext.Cur rent.Session

this will work in module or class.

Thanks,

Tee


"WilsonSmit h" <WS********@hot mail.com> wrote in message
news:eQ******** *****@TK2MSFTNG P11.phx.gbl...
When I use a session variable in a module, it says "Name session is not
declared". Is it not possible to use session variable in module?

Wilson


Nov 18 '05 #3
Thank you so much.
Wilson
"Tee" <th*@streamyx.c om> wrote in message
news:u#******** ******@TK2MSFTN GP09.phx.gbl...
When you want to use session but you are not in an aspx page or ascx ( web
user control ), you need to use the code
httpcontext.Cur rent.Session

this will work in module or class.

Thanks,

Tee


"WilsonSmit h" <WS********@hot mail.com> wrote in message
news:eQ******** *****@TK2MSFTNG P11.phx.gbl...
When I use a session variable in a module, it says "Name session is not
declared". Is it not possible to use session variable in module?

Wilson



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2449
by: Sean Pinto | last post by:
Ok, you all are going to have to bear with me on this one as it is kinda complicated to explain. I am implementing a company management suite that requires Role-Based authentiations (ie. users are in groups and groups have roles). I have one script which is included in EVERY page in the protected area (masterFuncs.php) and it contains function declarations as well as the authentication module kick-off. Here is a snippet from masterFuncs...
3
3541
by: PM | last post by:
I'm trying to make a kind of search history containing the 3 last searched words. So I'm using 3 Session Variables: Word1 / Word2 / Word3. In order to get this history working, I need to put the last searched word in the following Variable. Ex.: Session("Word3") = Session("Word2") Session("Word2") = Session("Word1")
1
2029
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session problem but I'm hoping the experts can help me figure that out. Our application uses a session variable to "pass" info from one form to the next. It has always worked fine for our users until a few weeks ago when one of our users started having a...
4
3912
by: Danny W | last post by:
Hi There! Is it possible to use HttpModule to replace the built-in ASP.NET Session object? I want to write a HttpModule that will handle storing and retrieving of session values from an external database. For example, when a page set values to Session object such as Session("somevar")=1 then I want my HttpModule to get notified and store the value into the external database. The same for "getting" the variable, I want my own...
10
2409
by: thomson | last post by:
Hi, i create a session variable in C# as follows Session , but iam not able to access the variable in VB.net like intmode=Session("var"); Why is that ? Regards
9
3193
by: Randy | last post by:
Hello, I'm having a strange problem. I've got a .NET web app which uses Session variables. Sometime, not all the time, they get cross threaded...that is...one user will have another user's Session variable(s) data assigned to them. I can't figure out why. I've read that other people are having this problem too but I haven't found a resolution yet. Can someone please tell me how I might go about fixing this? Thanks
4
2168
by: semsem22 | last post by:
hello, i m new to ASP.NET, but have experience with VB6....i have a couple of questions about the use of a module and the decleration of public objects in the module vs the use of sessions the main issue i am concerned with is performance....i would like to create a public object called Client, then i can set its properties from a Database, and have that object alive for the duration of the user's interaction with the system.....which helps...
7
4691
by: ADN | last post by:
Hi, I am creating a custom HTTPModule to intercept the request of when the user is attempting to retrieve a session variable. For instance, if I set a session variable in my code like so: session = "Hello World"; When the request for that session variable "myString" is attempted to be retrieved, I would like to intercept that request like so: if (Request is for session variable "myString")
4
2515
by: Cirene | last post by:
In my web.config I added <pages enableSessionState="true">. In each of my pages I also added EnableSessionState="True" to the Page declaration. (I didn't think this was necessary, but...) Any reason why even though I did this I keep getting this error.... Server Error in '/abc' Application.
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.