troubleshooting Question

Unable to cast object of type 'System.Web.HttpCookie' to type 'System.IConvertible'.

Avatar of weerdboil
weerdboil asked on
ASP.NET
5 Comments1 Solution2682 ViewsLast Modified:
Hi.

I get the following error:
Unable to cast object of type 'System.Web.HttpCookie' to type 'System.IConvertible'.


from this code:

        public static bool validateMember()
        {
            if (HttpContext.Current.Session["member_id"] != null)
            {
                object oMemberID = HttpContext.Current.Session["member_id"];
                if (Convert.ToInt16(oMemberID) > 0)
                    return true;
                else
                    return false;
            }

            else
                return false;
        }


bit weird because this only happens on live server (IIS) compared to local (Vis Studio)

Any ideas?


Thanks,
Dave

ASKER CERTIFIED SOLUTION
Havagan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros