473,378 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Possible unintended reference comparison



erroe message and code portion is like this....
how can i change this code to not occur to error

if (page.Session["UserId"] == null || page.Session["UserId"] !=
userId )
{
UserStatusSetting(page, userId);
}

Warning 2 Possible unintended reference comparison; to get a value
comparison, cast the left hand side to type 'string'
c:\inetpub\wwwroot\Minks\App_Code\SessionManager\S iteSessionManager.cs 28 51
http://localhost/Minks/
Dec 30 '05 #1
1 5954
Sotec,
When you refer to an object that is stored in Session State, it doesn't
^automatically^ assume its initial type from when you stored it there. So
for example, (if your userId is a string) you could use
(string)page.Session["UserId"] and now you would be comparing a string to a
string.
Hope that helps.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"sotec" wrote:


erroe message and code portion is like this....
how can i change this code to not occur to error

if (page.Session["UserId"] == null || page.Session["UserId"] !=
userId )
{
UserStatusSetting(page, userId);
}

Warning 2 Possible unintended reference comparison; to get a value
comparison, cast the left hand side to type 'string'
c:\inetpub\wwwroot\Minks\App_Code\SessionManager\S iteSessionManager.cs 28 51
http://localhost/Minks/

Dec 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rob Smeets | last post by:
Hi I was wondering, is it possible to disable the back button in internet explorer. Our Website is hosting a Siebel website, and the problem is that Siebel has problems with the use of the back...
1
by: Yoshitha | last post by:
hi we have one php project, and the similar project has to be developed in asp.net is it possible to use the same code in asp.net , i mean i've to call the functions used in PHP PROJECT IN...
5
by: Fernando Cacciola | last post by:
Hi, I need to produce an ID number that uniquely identifies a given object instance. (If the object is a boxed value, well, it won't really matter, but for _shared_ reference-types I really...
5
by: Mike Logan | last post by:
I used WSDL.exe to generate a client side web proxy for a web service, called the web service, got the results but an array returned by the web service is not in the results. However if I use...
2
by: Kay Schluehr | last post by:
The problem of unintended inheritance is typical for OO frameworks and can be explained as follows. Given a class Foo implemented by Alice and a derived class Bar of Foo implemented by Bob. Bar...
8
by: toton | last post by:
HI, One more small doubt from today's mail. I have certain function which returns a pointer (sometimes a const pointer from a const member function). And certain member function needs reference...
11
by: utab | last post by:
Dear all, in a class definition class X{ private: static map< string , map<string, int word_map; static void initialize(); };
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
14
by: Siegfried Heintze | last post by:
Why does VB.NET V2 force me to pass by value for my set function? When I try to change it to const byref it gives me a syntax error. It seems very inefficient to be passing strings around by value...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.