Visual Basic .NET » ASP.NET General Discussion
Session variables -- "gregg.chaney --


I have a method that uses session variables: When I make the call to the get the value the method immediately returns without executing any further. I noticed that if I use them inline they work : ex service.getSomeStuff(UseScaleWeight); What am I missing?
private const string useScaleWeight = "useScaleWeight";
protected bool UseScaleWeight {
get{ return (bool)Session
; }
set{ Session
= value; }
}


public string SetWeightValue(string curWeightStr, int currentWeight) {
bool useTheScale = UseScaleWeight; // fails on this line

-- Albert Weinert --


gregg.chaney schrieb:

private const string useScaleWeight = "useScaleWeight";
protected bool UseScaleWeight {
get{ return (bool)Session
; }
set{ Session
= value; }
}


public string SetWeightValue(string curWeightStr, int
currentWeight) {
bool useTheScale = UseScaleWeight; // fails on this
line

Which error? is Session
initialized? 


get{ return Session
!=null ?
(bool)Session
: false; }

get
{
object o = Session
;
return o != null ? (bool) o : false;
}

or

get{ return Convert.ToBoolean(Session
);}
--
Freundliche Grüße

Albert Weinert

http://der-albert.com 

-- Michael Schwarz --


Use System.Web.HttpContext.Current.Session
.

Regards,
Michael

On 7/6/06, gregg.chaney wrote:

I have a method that uses session variables: When I make the call to
the get the value the method immediately returns without executing any
further. I noticed that if I use them inline they work : ex
service.getSomeStuff(UseScaleWeight); What am I missing?
private const string useScaleWeight = "useScaleWeight";
protected bool UseScaleWeight {
get{ return (bool)Session
; }
set{ Session
= value; }
}


public string SetWeightValue(string curWeightStr, int
currentWeight) {
bool useTheScale = UseScaleWeight; // fails on this
line
>

--  

Best regards | Schöne Grüße Michael

Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz 
/
http://www.schwarz-interactive.de 
/
mailto:info
[Submit Comment]Home