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 8435543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:56:37+00:00 2026-06-10T06:56:37+00:00

I am using signalr and asp.net MVC3 to build a sample chat application. Here

  • 0

I am using signalr and asp.net MVC3 to build a sample chat application. Here is what my signalr hub looks like

public class MyHub:Hub,IDisconnect
{
 public Task Join()
 {
  string username = HttpContext.Current.User.Identity.Name;
  //find group based on username
  string group = getGroup(username)
  return Groups.Add(Context.ConnectionId, group);
 }

 public void doStuff()
 {
  string group = getGroup();
  Clients[group].doStuffOnBrowser();
 }
}

My problem is that my app crashed when the page loads. on stepping through with the debugger, I found that HttpContext.Current.User.Identity.Name is null even though the user has already been authenticated. How can I get the username in my Task Join() method?

  • 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-10T06:56:39+00:00Added an answer on June 10, 2026 at 6:56 am

    When using SignalR hubs you can use the HubCallerContext.User property to:

    Gets the user that was part of the initial http request.

    So try it with:

    public Task Join()
    {
        string username = Context.User.Identity.Name;
        //find group based on username
        string group = getGroup(username)
        return Groups.Add(Context.ConnectionId, group);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created Chat application using SignalR and Asp.net MVC. if user is idle for
I am using SignalR in an ASP.Net Web Application project and am having issues.
I've seen signalR vs html5 websockets for asp.net MVC chat application but it doesn't
I am currently using a signalR hub class to connect people through chat. I
I'm using signalr in my asp.net web forms application, all seems to work good,
I'm using the SignalR Javascript client and ASP.NET ServiceHost. I need the SignalR hubs
I am using SignalR in my MVC3 application, and since I have implemented StructureMap
I'm connecting to an ASP.NET webservice using the HTTPConnection class in Blackberry, but when
My web application have a chat app module built on SignalR hub. The app
I'm using SignalR to process clicks from the client on my MVC3 application. Every

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.