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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:52:10+00:00 2026-06-14T21:52:10+00:00

how to check the duplicate in Application state My problem scenario: I stored the

  • 0

how to check the duplicate in Application state

My problem scenario:

I stored the username and password in the application[“”] variable.
another user enters the username password i want to check for each and every user.

i tried for for loop but hard to find the count..

could you help me check the duplicate

     for (int j = 0; j < (int)System.Web.HttpContext.Current.Application["Userlogin"].ToString().Length - 1; j++)
                {
                    if (System.Web.HttpContext.Current.Application[i].ToString() == sKey)
                    {
                        Session["duplicateuser"] = "logout";
                        Returnmsg = "-3";
                    }
                }

but it shows the string length of the application[]

Thank in Advance

  • 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-14T21:52:11+00:00Added an answer on June 14, 2026 at 9:52 pm

    I stored the username and password in the application[“”] variable

    Wow, don’t. The Application state is shared among all users of your application. Never store user specific data in application state. Use Session state instead.


    UPDATE:

    If you want to check for concurrent user access you could store a collection of users into the application state such as IEnumerable<string>. Then you could check if a user is already logged in easily:

    public bool IsUserLoggedIn(string username, HttpApplicationStateBase application)
    {
        var users = application["users"] as IEnumerable<string>;
        if (users == null)
        {
            users = new ConcurrentBag<string>();
            application["users"] = users;
        }
    
        return users.Any(u => u == username);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Emulate Samsung Galaxy Tab I want to check my application on a
Possible Duplicate: check whether internet connection is available with C# I just want to
Possible Duplicate: Check if a variable is empty Simple PHP question: I have this
How can I check the duplicate signatures before adding. In the below scenario, I
Possible Duplicate: Facebook how to check if user has liked page and show content?
Possible Duplicate: Bluetooth support on Android Emulator I want to develop an Android Application
Possible Duplicate: Best way to detect when user leaves a web page Check if
Possible Duplicate: iPhone Documents directory and UIFileSharingEnabled, hiding certain documents I want the user
Possible Duplicate: License for C# desktop application I want to make my program lock
Possible Duplicate: Android - check for presence of another app How to check if

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.