473,407 Members | 2,320 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,407 software developers and data experts.

Setting Session within Method?

Needless to say I'm new to .Net. I'm trying to set Session variables
from within a method within a class.

(Name "Session" is not declared) is the message I get while typing in
the code. I don't get this while entering code within an .aspx.vb file.
Obviously I need to create and instance of some System.Web... object but
I don't know what it is. Any ideas?

Also by setting session variables from within the class and not sending
back values by properties, is this breaking some object oriented
concept?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
4 1624
Simply use the full namespace from within your class:
System.Web.HttpContext.Current.Session

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"thdevdex" <th******@dbcoders.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Needless to say I'm new to .Net. I'm trying to set Session variables
from within a method within a class.

(Name "Session" is not declared) is the message I get while typing in
the code. I don't get this while entering code within an .aspx.vb file.
Obviously I need to create and instance of some System.Web... object but
I don't know what it is. Any ideas?

Also by setting session variables from within the class and not sending
back values by properties, is this breaking some object oriented
concept?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
Simply use the full namespace from within your class:
System.Web.HttpContext.Current.Session

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire
"thdevdex" <th******@dbcoders.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Needless to say I'm new to .Net. I'm trying to set Session variables
from within a method within a class.

(Name "Session" is not declared) is the message I get while typing in
the code. I don't get this while entering code within an .aspx.vb file.
Obviously I need to create and instance of some System.Web... object but
I don't know what it is. Any ideas?

Also by setting session variables from within the class and not sending
back values by properties, is this breaking some object oriented
concept?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #3
I added that and it works fine, thanks. One more question.

I normally try to get answers from the VS2003 documentation and when I
was researching which object to use, the documentation for Session was
yapping about the HttpSessionState object. Is there a recommended area
within the documentation to figure out the appropriate system objects to
use and when?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4
I added that and it works fine, thanks. One more question.

I normally try to get answers from the VS2003 documentation and when I
was researching which object to use, the documentation for Session was
yapping about the HttpSessionState object. Is there a recommended area
within the documentation to figure out the appropriate system objects to
use and when?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #5

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

Similar topics

2
by: bagsmode | last post by:
Hi, I'm trying to set a session cookie and then redirect, however I get the error: Status: 302 Moved Location: /index.cgi I thought I recall getting an error like this when I first tried...
0
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
0
by: thdevdex | last post by:
Needless to say I'm new to .Net. I'm trying to set Session variables from within a method within a class. (Name "Session" is not declared) is the message I get while typing in the code. I...
5
by: ASP.Confused | last post by:
As you can tell from my previous posts on this issue...I'm really confused :-/ I have a few ASP.NET web applications on my web host's "https" server. Our web host has a single "bin" folder for...
9
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all...
13
by: Hope Paka | last post by:
I am storing user login information (not password) in the session. I also use, cookieless session. I realized that, if someone copy-pastes the URL after he/she logged in to the system to another...
10
by: Li Pang | last post by:
Hi, I created a html page from which I give a link to another web site. The new site is opened in a new window. When I opened multiple windows, they all have the same SessionID. I want ot know...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.