473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 4511
"WilsonSmith" <WS********@hotmail.com> wrote in message
news:eQ*************@TK2MSFTNGP11.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
johnwsaundersiii at hotmail
Answers:

1) In a page (or user control), the name "Session" refers to "this.Session"
(or Me.Session in VB.NET). This is the same as Context.Session, which means
this.Context.Session.
2) Anywhere else, "Session" is undefined unless you define it. However, you
can get access to the same value by referring to
System.Web.HttpContext.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.Current.Session

this will work in module or class.

Thanks,

Tee


"WilsonSmith" <WS********@hotmail.com> wrote in message
news:eQ*************@TK2MSFTNGP11.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.com> wrote in message
news:u#**************@TK2MSFTNGP09.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.Current.Session

this will work in module or class.

Thanks,

Tee


"WilsonSmith" <WS********@hotmail.com> wrote in message
news:eQ*************@TK2MSFTNGP11.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
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...
3
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...
1
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...
4
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...
10
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
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...
4
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...
7
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: ...
4
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...) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.