RedBottleSanitizer
RedBottleSanitizer

Reputation: 93

ASP.Net Session State Issue

I make use of Session Variable in a if statement.

if(SessionVariable == "AString") {

Do Something;

}

Problem is the comparison in If works fine if I maintain the session in InState, but doesn't if I use the SQLServer Mode.

The mistake I make is not convert the session variable to string.

Why does it work with InState Sessions and doesn't with SQLServer Sessions?

Upvotes: 2

Views: 214

Answers (1)

Adeel
Adeel

Reputation: 19228

When you use Sql Server Session State, the variables are serialized. When you pick that variable, you get the object type which you must have to be converted. On the other hand if you use InProc, the run time knows the underlying type of that variable

Upvotes: 2

Related Questions