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

  • Home
  • SEARCH
  • 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 7556307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:50:05+00:00 2026-05-30T11:50:05+00:00

I m building a website where i need to update project counter whenever its

  • 0

I m building a website where i need to update project counter whenever its updated in DB. when ever any user add a new project, the project counter should automatically update in browser, but i don’t want to send ajax request to server again and again to get count from DB and then update counter in web browser.

I want something similar “how facebook notification updated” automatically without refreshing page or sending any ajax request, i know there are using some PUSH technology but i not sure how it works.

It will be very great if someone provide some Example code to achieve this.

Thanks…

  • 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-05-30T11:50:07+00:00Added an answer on May 30, 2026 at 11:50 am

    Have you considered using SignalR?

    http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

    http://signalr.net/

    Here is the sample code based on a quick POC after reading some SO replies and above articles. Hope it helps.

    • Create a new empty ASP.NET web application project
    • Add the SignalR package via NuGet

    • Add a UserCounter.cs with following code. Just need to inherit the class from Hub base class.

      using SignalR.Hubs;
      public class UserCounter : Hub { }
      
    • Add a Default.aspx with following code:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head runat="server">
      </head>
      <body>
          <form id="form1" runat="server">
              <div>
                  Number of users currently online - <b><span id="noOfUsers">0</span> users</b>
                  <br />
                  <a target="_blank" href="UpdateNoOfUsers.aspx">Change number of users</a>
              </div>
          </form>
          </body>
          <script src="Scripts/jquery-1.6.4.js" type="text/javascript"></script>
          <script src="Scripts/jquery.signalR.js" type="text/javascript"></script>
          <script src="/signalr/hubs" type="text/javascript"></script>
      
          <script type="text/javascript">
          $(function () {
              var usc = $.connection.userCounter;
      
              usc.noOfUsersUpdated = function (message) {
                  $('#noOfUsers').text(message);
              };
      
              $.connection.hub.start();
          });
      </script>
      
      </html>
      
    • Add a UpdateNoOfUsers.aspx with following code:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head runat="server">
      </head>
          <body>
              <form id="form1" runat="server">
                  <div>
                      No. of users: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                      <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
                  </div>
              </form>
          </body>
          </html>
      
    • Add an event-handler for button-click for button in UpdateNoOfUsers.aspx

      using SignalR;
      using SignalR.Infrastructure;
      using SignalR.Hosting.AspNet;
      
      protected void Button1_Click(object sender, EventArgs e)
      {
          IConnectionManager connectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
          dynamic clients = connectionManager.GetClients<UserCounter>();
          clients.noOfUsersUpdated(TextBox1.Text);
      }
      
    • Run the application after setting “Default.aspx” as the start up page

    • Click on the “Change number of users” link to open a new browser window

    • Enter a number in text-box and click on the button to see the value change in base window! Open this page in some other browser and see the same behaviour!

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

Sidebar

Related Questions

I am building a website where I have a need that user should be
I am building a website where i need a page where user can upload
We are building a training website where we need to track viewers watching videos
I'm building a website in ASP.Net, using MVC, and need to list a set
I'm building a website that requires very basic markup capabilities. I can't use any
I'm building a website that will be an open-source, user-contributed content kind of thing,
I'm building a website that will require user registration and logon. I would like
I have a website I am building on localhost: http://localhost/my-website I need to test
I am building a website for my compty, and i need to change the
I'm building a website that contains users with user profiles. Many of the fields

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.