global_asax do not implement IHttpApplicationDataProvider error

  •  09-28-2006, 9:46 AM

    global_asax do not implement IHttpApplicationDataProvider error

    This is my Global.asax.cs file.
     
     

    using System;

    using System.Collections;

    using System.ComponentModel;

    using System.Web;

    using System.Web.SessionState;

    using System.Web.Security;

    using System.Data;

    using System.Data.SqlClient;

    using CuteSoft.Chat;

    /// <summary>

    /// Global Application Handler

    /// </summary>

    public class Global : System.Web.HttpApplication, IHttpApplicationConnectionStringProvider,IHttpApplicationUserAdapter,IHttpApplicationDataProvider,IHttpApplicationSupportLogin

    {

    private System.ComponentModel.IContainer components = null;

    public Global()

    {

    InitializeComponent();

    }

     

    #region IHttpApplicationConnectionStringProvider Members

    public static String ConnectionString

    {

    get

    {

    return System.Configuration.ConfigurationManager.AppSettings["SqlClient"].ToString();

    }

    }

    //Step 1: Let CuteChat know your databse connection string

    public string GetConnectionString(CuteSoft.Chat.UserIdentity user)

    {

    return ConnectionString;

    }

    #endregion

    #region IHttpApplicationUserAdapter Members

    //Step 2: Let CuteChat know who has logged in the website

    public string GetUserUniqueName()

    {

    return Session["UserName"].ToString();

    }

    public CuteSoft.Chat.UserIdentity GetUserIdentity()

    {

    string uniquename = GetUserUniqueName();

    if (uniquename == null)

    {

    return CuteSoft.Chat.UserIdentity.CreateNull();

    }

    CuteSoft.Chat.UserIdentity identity = new CuteSoft.Chat.UserIdentity(uniquename, null, Request.UserHostAddress);

    return identity;

    }

    #endregion

    #region IHttpApplicationDataProvider Members

    //Step 3: Let CuteChat know your membership database information

    //Check the user is an administrator or not.

    public bool IsAdministrator(string useruniquename)

    {

    //return Session["Role"].ToString() == "Admin";

    return true;

    }

    //Return user's display name

    public string GetUserDisplayName(string useruniquename)

    {

    //return Session["UserName"].ToString();

    return "admin";

    }

    //Retrieves all the user's unique names in the database.

    public string[] ListUserUniqueName()

    {

    ArrayList names = new ArrayList(Membership.GetAllUsers());

    return (string[])names.ToArray(typeof(string));

    }

    //Return an array of user names containing the input string.

    public string[] SearchUserUniqueNameByDisplayName(string userDisplaName)

    {

    //CommunityServer.UserQuery query = new CommunityServer.UserQuery();

    //query.SearchText = userDisplaName;

    //query.IncludeHiddenUsers = true;

    //query.SearchUsername = true;//there's no SearchDisplayName ?

    //CommunityServer.Components.UserSet userset = CommunityServer.Users.GetUsers(query, true);

    //ArrayList names = new ArrayList();

    //foreach (CommunityServer.Components.User user in userset.Users)

    //{

    // if (user.IsAnonymous) continue;

    // names.Add(user.Username);

    //}

    //return (string[])names.ToArray(typeof(string));

    ArrayList names = new ArrayList(Membership.GetAllUsers());

    return (string[])names.ToArray(typeof(string));

    }

    //Check the user is a lobby admin or not (only for integrated room).

    public bool IsLobbyAdmin(string useruniquename, CuteSoft.Chat.CuteChatLobby lobby)

    {

    //if (lobby.Integration == null) return false;

    //CommunityServer.Components.User user=CommunityServer.Users.FindUserByUsername(useruniquename);

    //if(user==null)

    // return false;

    //if (lobby.Integration.StartsWith("Forum:"))

    //{

    // int forumid = int.Parse(lobby.Integration.Substring(6));

    // CommunityServer.Discussions.Components.Forum forum = CommunityServer.Discussions.Components.Forums.GetForum(forumid);

    // if (forum == null)

    // {

    // return false;

    // }

    // return CommunityServer.Components.Permissions.ValidatePermissions(forum

    // , CommunityServer.Components.Permission.Administer

    // , user);

    //}

    return false;

    //return "NOT IMPLEMENTED";

    }

    #endregion

    #region IHttpApplicationSupportLogin Members

    //Step 4: Let CuteChat know your membership database information

    //Check the user is an operator or not (only for live support).

    public bool SupportLogin(string username, string password)

    {

    // EXAMPLE:

    //if (username == null) return false;

    //username = username.Trim();

    //if (username == "") return false;

    //if (password == null) return false;

    ////IMPORTANT: if the user is not the operator, do not return true;

    ////use the CuteChat API to check it

    //if (CuteSoft.Chat.ChatApi.FindOperator(username) == null)

    // return false;

    ////does the user exist?

    //CommunityServer.Components.User user = CommunityServer.Users.FindUserByUsername(username);

    //if (user == null)

    // return false;

    ////use CommunityServer API to validate the user

    //user = new CommunityServer.Components.User();

    //user.Username = username;

    //user.Password = password;

    //CommunityServer.Components.LoginUserStatus status = CommunityServer.Users.ValidUser(user);

    //if(status!=CommunityServer.Components.LoginUserStatus.Success)

    //{

    // return false;

    //}

    ////FORM-Authentication ,

    //System.Web.Security.FormsAuthentication.SetAuthCookie(user.Username, false, "/");

    return true;

    }

     

    // Fire when the conversation start

    public void SupportInit()

    {

    //no auto login.

    }

    #endregion

    #region Web Form Designer generated code

    /// <summary>

    /// Required method for Designer support

    /// do not modify this method

    /// </summary>

    private void InitializeComponent()

    {

    this.components = new System.ComponentModel.Container();

    }

    #endregion

    }

     

View Complete Thread