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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:30:24+00:00 2026-05-15T15:30:24+00:00

I have a multiple web sits asp.net application. In this application different domains using

  • 0

I have a multiple web sits asp.net application.
In this application different domains using the same pages.
All pages inherit from base class named: PageBase
wich inherit from System.Web.UI.Page.
By using: HttpContext.Current.Request.ServerVariables[“HTTP_HOST”]
i cen determine what is the domain and then get all the info i need
for this domain and everything is working good.

My problem begin when i want to use different visitor counter for each site based on session.
Because Global.asax have Global events:
Session_Start
Session_End
simple counter will count all visitors on all sites together.
I try to make code behind for the Global.asax in different class
but i cold not get in that class the PageBase(System.Web.UI.Page) web site info.

I will be very thankful for any ideas to solve this problem

cheinan

  • 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-15T15:30:25+00:00Added an answer on May 15, 2026 at 3:30 pm

    I am not able to browse from one “site” to the other within the same session each site have is on

    different session created.

    but i am very thankful to you because you gave me en idea
    how to solv this problem

    here is what i did:
    i created counter class with Dictionary “onlineList” were i automatic creat for each site a key:

    public abstract class counter{
    public static Dictionary<string, int> onlineList = new Dictionary<string, int>();
    
     //do add one count
    public static void doSiteCountOn(string siteID)
    {
        if (onlineList.ContainsKey(siteID))
        {
            onlineList[siteID] += 1;
        }
        else
        {
            onlineList.Add(siteID, 1);
        }
    }
    
    //do less one count
    public static void doSiteCountOff(string siteID)
    {
        if (onlineList.ContainsKey(siteID))
        {
            onlineList[siteID] -= 1;
        }
        else
        {
            onlineList.Add(siteID, 0);
        }
    }
    
    //get the count
    public static string onlineCount(string siteID)
    {
        if (onlineList.ContainsKey(siteID))
        {
            return onlineList[siteID].ToString();
        }
        else
        {
            return "0";
        }
    }
    
    //reset the count if needed
    public static void resetCount(string siteID)
    {
        if (onlineList.ContainsKey(siteID))
        {
            onlineList[siteID] = 0;
        }
    }}
    

    on my base page i check if there is Session[“siteID”]
    and if not i start one and make my counter class to add 1 to the site counter:

    if (Session["siteID"] == null){
    Session["siteID"] = _siteID;
    counter.doSiteCountOn(_siteID);}
    

    and finaly on my Session_End i do one count less:

    void Session_End(object sender, EventArgs e){
    if (Session["siteID"] != null)
        {
            counter.doSiteCountOff(Session["siteID"].ToString());
        }}
    

    thank for your halp
    and sorry for my late respons

    cheinan

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

Sidebar

Related Questions

I have multiple master pages in my asp.net mvc web application... Each of the
I have an ASP.NET application running on multiple IIS6 web servers, with a SQL
I have a web application with multiple WARS. These WARS all perform different functions
I have a web site (ASP.NET, no MVC) with multiple web forms for filling
I have multiple servers across the globe, running the same web application. The user
I have an ASP.NET page that needs to make calls to multiple web services
I have a common jar that multiple web applications are using. All the web
I have multiple asp.net web apps serving a set of files. Periodically, one will
I have a web application with multiple web services. This web application has business
For past projects(the last few have been web using asp.net mvc) we created a

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.