HELP!

  • Thread starter Mike Trebilcock
  • 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
 
M

Matt Berther

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.
 
L

Lucas Tam

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.
 
M

Mike Trebilcock

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top