Click here to Skip to main content
15,908,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am able to do multi chating but unable to process it to one to one. please can u help me to find. and sometimes i dont find connection establishing to proxy. what scripts aree required to connect it.?

What I have tried:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sample.Models;
 

namespace Sample.Controllers
{
    public class HomeController : Controller
    {

        public ActionResult Chat()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Chat(string message)
        {
            if (OnlineUser.lobj.Where(i => i.sessionId == System.Web.HttpContext.Current.Request.Cookies["ASP.NET_SessionId"].Value.ToString()).Count() > 0)
                OnlineUser.ADDusers("", System.Web.HttpContext.Current.Session["UserName"].ToString(),  System.Web.HttpContext.Current.Session["UserId"].ToString(), System.Web.HttpContext.Current.Request.Cookies["ASP.NET_SessionId"].Value.ToString());
            //hdnUserId.Value = Session["UserId"].ToString();
            //hdnUserName.Value = Session["UserName"].ToString();
            {

            }
            return View();
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}



==model class
==
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Sample.Models
{
    public static class OnlineUser
    {
        public static List<UserModal> lobj= new List<UserModal>();

        public static void ADDusers(string strconnectionId, string struserName, string struserId, string strsessionId)
        {
            UserModal uobj = new UserModal();
            uobj.connectionId = strconnectionId;
            uobj.userName = struserName;
            uobj.userId = struserId;
            uobj.newStatus=true;
            uobj.sessionId = strsessionId;
            lobj.Add(uobj);
        }
    }
}
Posted
Updated 6-Nov-16 21:48pm

Check out the private chat section in this article Asp.Net SignalR Chat Room[^]
 
Share this answer
 
v2
HEllo ,

Please have a look at the below link. I had tried the same.
[^]

Thank You
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900