HELP!

  • Thread starter Thread starter Mike Trebilcock
  • Start date Start date
M

Mike Trebilcock

Can anybody tell me when this code:

Select Case Mode

Case "TCM"

Trace.Write("TIGER.MainPage.PageLoad", "Calling TCMScreen")

TCMScreen()

Case "TIGER"

Trace.Write("TIGER.MainPage.PageLoad", "Calling TIGERScreen")

Case "ADMIN"

Trace.Write("TIGER.MainPage.PageLoad", "Calling AdminScreen")

Case Else

Trace.Write("TIGER.MainPage.PageLoad", "Session Lost")

Response.Redirect("Login.aspx")

End Select

Works when I use this code to fill the Mode variable

Dim Mode As String = "TCM"

But not work when I fill it with a session varible even though it has (I
believe) exactly the same value stored:

Dim Mode As String = Session("Mode")



I am begining to loose what little sanity I have left any advice would be
gratefully received



Mike
 
Hello Mike,

Without knowing for sure what error you are encountering, I would suggest
that you check that Session("Mode") is not null.

Secondly, Id make sure that the Session("Mode") value is of the correct case.
I believe that VB string comparisons are case-sensitive, but Im not sure.
 
Dim Mode As String = "TCM"

But not work when I fill it with a session varible even though it has (I
believe) exactly the same value stored:

Dim Mode As String = Session("Mode")



I am begining to loose what little sanity I have left any advice would be
gratefully received

A session variable = nothing at page initlization, so you'll need to set a
default value for the session variable.
 
The Session variable is set by the login page which gets the mode the
website should be operating in from a sql server when it authenticates the
user.

When I look at the Trace.axd the session variable correctly contains the
string "TCM". When the select statement evaluates the string it always ends
up going to the case else branch.

?????

Mike
 
Back
Top