CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 11/21/2004 10:40:59 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 27 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
phrenetic
Asp.Net User
Accessing Session variables11/21/2004 10:40:59 AM

0/0

If I create a class file within my application, how can I get it to recognise my Session variables?

At the moment, the compiler throws an error message whenever a code line contains a Session variable.
Alistair
Fredrik N
Asp.Net User
Re: Accessing Session variables11/21/2004 10:44:57 AM

0/0

You can get the session from the System.Web.HttpConext class. Use the HttpContext's Current property to get the current context.

System.Web.HttpContext.Current.Session["Your Id"]
/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
timallard
Asp.Net User
Re: Accessing Session variables12/10/2004 3:21:29 PM

0/0

That code doesn't run, it blows on "Current". For webdev express you need to use System.Web.HttpContext.Session[int or string], had the same trouble with a lot of vs c# 2003 code. It seems for webdev express you need to reference the object a level above what you need ... in this case I used:

protected System.Web.HttpContext objHttpContext;

Then in the code:

this.objHttpContext.Session[]

This works ...
tom mallard


analyst/architect, SDE

Fredrik N
Asp.Net User
Re: Accessing Session variables12/10/2004 3:43:06 PM

0/0

>That code doesn't run, it blows on "Current".

I have no problem with it.

For example this work:


public class MyClass
{
public MyClass()
{
object value = HttpContext.Current.Session["MyKey"];
}
}

/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
timallard
Asp.Net User
Re: Accessing Session variables12/10/2004 5:58:33 PM

0/0

Are you compiling this in webdev express? Doesn't compile for me, kicks out .Current as invalid, had to do things as per my previous post or it won't compile. In vs c# 2003 .net 1.1 using Current is valid and compiles OK.
tom mallard


analyst/architect, SDE

Fredrik N
Asp.Net User
Re: Accessing Session variables12/10/2004 10:11:10 PM

0/0

It works in the October CTP.
/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
timallard
Asp.Net User
Re: Accessing Session variables12/11/2004 4:29:56 AM

0/0

Now it works ... don't really know why it wasn't working before, intellisense didn't have .Current available so I tried to get it to work by referencing before the event that used it. After your post I tried the standard way again and it didn't work.

So both ways work now including intellisense having .Current, don't really know what I changed that affected this ... have had trouble with websites as well but seem to have those taken care of now, mainly config problems so those really shouldn't have anything to do with this. This machine didn't have 2.0 on it before, who knows.
tom mallard


analyst/architect, SDE

7 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide Authors: Larry Edward Ullman, Pages: 572, Published: 2003
Sams Teach Yourself PHP in 24 Hours: Php in 24 Hours Authors: Matt Zandstra, Pages: 550, Published: 2004
PHP for the World Wide Web: Visual Quickstart Guide Authors: Larry Edward Ullman, Pages: 450, Published: 2004
Learning PHP and MySQL: A Step-by-Step Guide to Creating Dynamic, Database-Driven Web Sites Authors: Michele E. Davis, Jon Phillips, Pages: 411, Published: 2007
Web Database Applications with PHP and MySQL: Building Effective Database-Driven Web Sites Authors: Hugh E. Williams, David Lane, David John Lane, Pages: 796, Published: 2004
Sams Teach Yourself Dreamweaver UltraDev 4 in 21 Days: UltraDev 4 Authors: John Ray, Pages: 767, Published: 2000
Php 5 Fast & Easy Web Development: Fast & Easy Web Development Authors: Julie C. Meloni, Pages: 545, Published: 2004
Macromedia ColdFusion MX 7 Web Application Construction Kit: web application construction kit Authors: Ben Forta, Raymond Camden, Leon Chalnick, Angela C. Buraglia, Pages: 1440, Published: 2005
MySQL Cookbook: Solutions and Examples for MySQL Database Developers. Authors: Paul DuBois, Pages: 992, Published: 2003
Dreamweaver CS3: The Missing Manual Authors: David Sawyer McFarland, Pages: 995, Published: 2007

Web:
Accessing session variables in different pages How do you access session variables in different pages of an application? For example: I have Session("USerId") = "ABC" in page1.aspx. ...
How to create a session variable Information stored in session variables is site visitor specific. Different site visitors cannot access each other's session variable information. ...
How to access session variable? - ASP How to access session variable?. Get answers to your questions in our ASP forum.
How do I set session variables from client-side script? How do I access my server's registry from an ASP page? ... How do I persist session state without cookies / session variables? ...
Session Variables Session variables are very easy to use. One use for session variables might be storing user preferences or password access. Session variables disappear as ...
ASP Session object Common information stored in session variables are name, id, ... You can also store user preferences in the Session object, and then access that preference ...
Don't redirect after setting a Session variable (or do it right ... When you create a new session (that is, the first time you write to a Session variable), ASP.NET sets a volatile cookie on the client that contains the ...
Accessing Session variables from VBScript, ASP.NET App ... Trying to access Session variables from VBScript in an ASP.NET application. I have an included vbscript file on my page:
Accessing session variables : The Official Microsoft Silverlight Site Accessing session variables. Last post 06-16-2008 3:18 AM by Yi-Lun Luo - MSFT. 2 replies. ... 06-13-2008 11:03 AM. Re: Accessing session variables ...
Joomla! • View topic - Adding and accessing session variables in J1.5 Post subject: Re: Adding and accessing session variables in J1.5. Post Posted: Thu May 29, 2008 7:05 pm. Joomla! Apprentice. Joomla! Apprentice. Offline ...

Videos:
ASP.Net (VB.Net) Session Variable ArrayList - Shalvin Microsoft ASP.Net (VB.Net) Session Variable ArrayList - Shalvin Visit my blog: http://shalvinpd.blogspot.com/2008/06/session-asp-net-storing-dataset...
Asp.Net C# Session Variable (Without voice) - Shalvin Visit http://shalvinpd.blogspot.com/2008/02/aspnet-20-profile.html for information on Profile which is a better solution than Session variable. Movie...
Setup Factory 7 Training Chapter 3 Lesson 15 Quickstart Guide - Editing session variables
Actionscript Tutorial - Variables (session 1) Takes you through the concept of variables in Actionscript
Access and Modify User Profile using PHP and Dreamweaver Easy to modify and access user profile using login functin a
AAS 212th Meeting: Session 56: Imaging with the CHARA Interferometer Imaging is now a reality at the CHARA interferometer (Mt. Wilson, CA) using the newly-commissioned Michigan Infrared Combiner (MIRC). In this talk, I...
How to send variable with session How to send variable with session
Edubuntu Setting Env Vars in BashRC: Where's Apache in Debian? In this screencast you'll see how to set environment variables in the bashrc file. And you'll see me thrashing around looking for the apache folder. ...
First multiplay session in Rigs of Rods Its the very first multiplayer session with an experimental network code. The movie was made by Thomas (from Germany), and I'm the other player (from...
The Beatles, 30 July 1968, EMI Studio 2 The Beatles EMI Studio 2 London, UK 30 July 1968 7:30 pm - 3:30 am Running time: 5:44 This interesting tidbit is from a documentary entitled 'Music...




Search This Site:










need help with dynamic loading of treeview

unit of measure

looking for advice regarding automated processing

object reference not set to an instance of an object

i'm sure this is simple, but how do you install a skin?

using web.config to control downloads

treeview and expanded root node and saving state

networkservice user

the best way for oop

online combine study... anybody interested???

freetextbox

is asp.net 2.0 able to optimize core2duo?

move portal from 2.12 to 3.0.*

exclude directory from build

sub directory with apps

what am i doing wrong here?

need suggestion to setup my own small cms system

seting up asp web developement (need advice)

external link issue

banner modules suggestions?

paypal issue

who's developing with web matrix & toolkit?

2 customvalidators

can't install!

problem inserting into the table

how to setting date of datetimepicker ?

assembly is in gac - but imports doesnt work

setting the border color of a table

asp.net site for all browsers

asp to asp.net 2.0 migration

 
All Times Are GMT