Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8969825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:38:52+00:00 2026-06-15T17:38:52+00:00

I asked this question before which has got a very good response. But as

  • 0

I asked this question before which has got a very good response. But as I am new to asp.net (and jquery) cant understand how the program is flowing.

Summary:

I have created a Basic chat application. Now I am trying to add a advanced function like whenever a user is online (connected to a server), the server should show or broadcast the available online user’s username to all the users connected to that server.

By referring the responses to the previous question (s0nica and VinayC), I modified my class file and jquery file, which are giving errors as shown in the below links. (I think I am very close)

Chat.cs (Two errors, I mentioned errors in between code comments)
file.js (Working fine, refer it if you need to)

Please have a look to the above files and assist me.

PS: In the previous post, I was thinking that if I change the Global.asax code, my problem will be solved.. which I realized later as wrong..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:38:53+00:00Added an answer on June 15, 2026 at 5:38 pm

    Your first error from:

    Clients.joins(Context.ConnectionId, Caller.username, DateTime.Now);
    

    Shold be:

    Clients.All.joins(Context.ConnectionId, Clients.Caller.username, DateTime.Now);
    

    Other errors associated with it: In your JS file it should be:
    Line 15

    chat.state.username = chatUsername;
    

    Second error:
    The error is exactly as it states, you do not have a toList function off of your dictionary object. Secondly you can’t plainly convert a List or a string directly to a Chat object.

    Based on your setup you currently dont have a proper “user” list to return. Right now you’re saving a List to represent an individual user. You might want to try changing your dictionary object to be something like

    static ConcurrentDictionary<string, User> _users = new ConcurrentDictionary<string, User>();
    

    Where User is:

    public class User
    {
        public string Name { get; set; }
        public string ConnectionID { get; set; }
    }
    

    Then on your Joined function you could just do:

    public void Joined()
    {
        User user = new User 
        { 
            Name = Clients.Caller.username,
            ConnectionID = Context.ConnectionId
        };
    
        _users.TryAdd(user.ConnectionID, user);
        Clients.All.joins(user.ConnectionID, user.Name, DateTime.Now);
    }
    

    Lastly your GetConnectedUsers would end up(make sure you’re ‘using System.Linq;’):

    public List<User> GetConnectedUsers()
    {
        return _users.Values.ToList();
    }
    

    I probably went a little bit overboard but hopefully this helps!

    If you need a reference to the change log from SignalR 0.5.3 to 1.0 alpha here’s a great post on all of the modifications:
    http://weblogs.asp.net/davidfowler/archive/2012/11/11/microsoft-asp-net-signalr.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has been asked here before, but the author wasn't very clear and
Ok guys I know this question has been asked before but I am very
I'm new to jquery, and sorry if this question is asked before (could find
This question has been asked before but i still don't understand it fully so
Maybe this question has been asked many times before, but I never found a
This question has been asked before, see: jQuery select only tr/td in main table,
I know this question has been asked before, but none of the answers in
This question has been asked many times before, but they all seem to relate
I apologize if this question has been asked before, but my case is a
I'm not sure if this question has been asked before but what are the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.