Re: i have this type code but i also get the eroor which i was posted pls help me

  •  06-12-2007, 12:21 AM

    Re: i have this type code but i also get the eroor which i was posted pls help me

    <%@ Application Language="C#" %>

    <%@ Import Namespace="CuteSoft.Chat" %>

    <%@ Implements Interface="CuteSoft.Chat.IHttpApplicationConnectionStringProvider" %>

    <%@ Implements Interface="CuteSoft.Chat.IHttpApplicationUserAdapter" %>

    <%@ Implements Interface="CuteSoft.Chat.IHttpApplicationDataProvider" %>

    <%@ Implements Interface="CuteSoft.Chat.IHttpApplicationSupportLogin" %>

    <script runat="server">

    public class Global : System.Web.HttpApplication

    {

    public string GetConnectionString(CuteSoft.Chat.UserIdentity user)

    {

    return System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];

    }

    //IHttpApplicationUserAdapter

     

     

     

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

    {

    // EXAMPLE 1 (Community Server):

    //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;

    // EXAMPLE 2 (IbuySpy):

    // return false;

    return false;

    }

    public bool SupportLogin(string username, string password)

    {

    // EXAMPLE 1 (Community Server):

    //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, "/");

    // EXAMPLE 2 (IbuySpy):

    // if(username==null||username.Trim()=="")

    // return false;

    // if(password==null||password=="")

    // return false;

    // username=username.Trim();

    // string email=username;

    // string uniquename=email;

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

    // return false;

    // UsersDB udb=new UsersDB();

    // string name=udb.Login(email,PortalSecurity.Encrypt(password));

    // if(name==null||name=="")

    // return false;

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

    // return true;

    return false;

    }

     

    public void SupportInit()

    {

    }

     

    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 (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 };

    }

    }

    }

    </script>

View Complete Thread