I'm having an issue comparing 2 objects in an ASP.NET Project, I'm not sure if I am a beginner or what but this is my actual code:
private void CheckFriendshipStatus()
{
if (Object.ReferenceEquals(Session["UserId"].ToString(), Session["CurrentProfileId"].ToString()))
{
btnAddAsFriend.Visible = false;
}
else
{
DataTable dt1 = new DataTable();
string chkfriendRequest = "SELECT * FROM Friends WHERE (MyId='" + Session["UserId"].ToString() + "' and FriendId='" + Session["CurrentProfileId"].ToString() + "') OR (MyId='" + Session["CurrentProfileId"].ToString() + "' and FriendId='" + Session["UserId"].ToString() + "')";
Then I tried:
var obj1 = Session["UserId"].ToString();
var obj2 = Session["CurrentProfileId"].ToString();
if (obj1 == obj2)
{
btnAddAsFriend.Visible = false;
}
else
{
and then I tried setting the value to null first and then assigning the session values. I'm out of ideas, any other one will be highly appreciated