Results 1 to 3 of 3

Thread: [RESOLVED] How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]

  1. #1

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    Resolved [RESOLVED] How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]

    If I try it that way, I get can not convert to boolean. The only options I get when I type . to append a conversion does not include a conversion to boolean.

    How can I check if a session variable exists before checking it's value. This causes me problems.


    When I looked into convert to boolean in the MSDN. How do you read this? I don't understand it:
    .NET Framework Class Library
    Convert.ToBoolean Method (Boolean)

    Returns the specified Boolean value; no actual conversion is performed.

    [C#]
    public statibool ToBoolean(
    bool value
    );

  2. #2

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    Re: How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]

    I tried:

    if (!Session["LoggedIn"].Equals(null))

    but getting not set to reference an instance of an object.

  3. #3

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    Re: How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]

    (Session["LoggedIn"]) !=null)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width