Re: Object reference not set to an instance of an object

  •  09-21-2007, 3:11 PM

    Re: Object reference not set to an instance of an object

    PeteMVG:
    It seems fine. The messenger/chat database is integrated into the main site db, which is all working fine. Using the chat API we can query lobby information and sign into the cutesoft admin pages to create new rooms. If the connection string was wrong we wouldn't be able to do this?

     
    PeteMVG,
     
    The above information is not enough for debugging.
     
    Please use the following simple integration code and try again.
     

      //IHttpApplicationConnectionStringProvider

      public string GetConnectionString(CuteSoft.Chat.UserIdentity user)
      {
       return System.Configuration.ConfigurationSettings.AppSettings["CuteChat.SqlClient.ConnectionString"];
       //return System.Configuration.ConfigurationSettings.AppSettings["CuteChat.OracleOleDb.ConnectionString"];
       //return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\CuteChat3.mdb;";
      }

      //IHttpApplicationUserAdapter

      public CuteSoft.Chat.UserIdentity GetUserIdentity()
      {
       string id=GetUserUniqueName();
       if(id==null)
        return CuteSoft.Chat.UserIdentity.CreateNull();
       CuteSoft.Chat.UserIdentity identity=new CuteSoft.Chat.UserIdentity(id,null,Context.Request.UserHostAddress);
       //identity.CustomItems["myprop"]="myval";
       return identity;
      }

      public string GetUserUniqueName() //Get the ID of current user
      {
    //   if(Session!=null)
    //   {
    //    return (string)Session["userid"];
    //   }

       if(Context.User.Identity.IsAuthenticated)
        return Context.User.Identity.Name;

       return null;
      }

      //IHttpApplicationDataProvider

      public string[] ListUserUniqueName()
      {
       //list the known users
       return new string[]{"admin"};
      }
      
      public bool IsAdministrator(string useruniquename)
      {
       if(string.Compare(useruniquename,"admin",true)==0)
        return true;
       return false;
      }

      public string GetUserDisplayName(string useruniquename)
      {
       switch(useruniquename.ToLower())
       {
        case "admin":
         return "Administrator";
        case "terry":
         return "Terry.X";
        case "marry":
         return "Marry.White";
        default:
         return useruniquename + "test";
       }
      }

      public string[] SearchUserUniqueNameByDisplayName(string userDisplaName)
      {
       switch(userDisplaName.ToLower())
       {
        case "administrator":
         return new string[]{"admin"};
        case "terry.dai":
         return new string[]{"terry"};
        default:
         return new string[]{userDisplaName};
       }
      }
      public bool IsLobbyAdmin(string useruniquename,CuteSoft.Chat.CuteChatLobby lobby)
      {
       return false;
      }

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread