Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2004, 06:47 PM
Authorized User
 
Join Date: Nov 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Checking the value of a session?


Hey guys, In my code I want it to check if a session is equal to a particular value, in this case a string. I can output the session value no problem so I know it's there, but it doesn't work in my conditional statement. Here it is:

Code:
void Page_Load()
{

if (Session["user"].ToString() == "Chris") //I've also tried not using the ToString() method
 {
   message.Text = "It worked!";
 }
else
 {
   message.Text = "It didn't";
 }
}
After it runs I get: "It didn't"
If I output the value of the session, it shows: "Chris"

Any ideas on what's causing this?

Thanks guys,

Chris





Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking Processes AggressiveFish Beginning VB 6 0 September 19th, 2006 01:29 PM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM
Checking a ComboBox Salte C# 2 November 30th, 2004 05:49 PM
checking for duplicates jammykam Access 3 October 2nd, 2003 08:06 PM
Checking for a number aware Classic ASP Basics 5 June 5th, 2003 09:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.