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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:58:46+00:00 2026-05-13T16:58:46+00:00

Hello I have created XML which holds codes for properties and number of page

  • 0

Hello I have created XML which holds codes for properties and number of page viewings for that code:

<?xml version="1.0" encoding="utf-8"?>
<data>
    <nehnutelnost code="BSPO066P">35</nehnutelnost>
     <nehnutelnost code="PMDM029P">4</nehnutelnost>
</data>

I think I have found possible weakness with this, today all counters disapeared and all started from scratch.

This is the code which checks for code existence in XML file and either add +1 or create new XML tag with 1.

        int intSeenCount = 0;
        XDocument xmlSeenCount = new XDocument();
        xmlSeenCount = XDocument.Load(Server.MapPath(@"App_Data\lozjoCounts.xml"));

        XElement xmlElement = xmlSeenCount.XPathSelectElement("data/nehnutelnost[@code = '" + strCisloZakazky + "']");

            if (xmlElement == null)
            {
                xmlElement = (new XElement("nehnutelnost",
                                                        new XAttribute("code", strCisloZakazky),
                                                        ++intSeenCount));
                xmlSeenCount.Element("data").Add(xmlElement);
            }
            else
            {
                intSeenCount = (Convert.ToInt32(xmlElement.Value) + 1);
                xmlElement.Value = intSeenCount.ToString();
            }
            xmlSeenCount.Save(Server.MapPath(@"App_Data\lozjoCounts.xml"));

My questions would be:

  1. is it possible that there was page opened by someone else at the same time and file just got overwritten or somehow reseted the data?

  2. is there any other way how to keep number if page visitors so it wont reset in future?

Thank you.

Fero

  • 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-13T16:58:47+00:00Added an answer on May 13, 2026 at 4:58 pm

    It seems you are having a concurrency problem.

    You could lock the writing operation, but then you must be aware that your are creating a possible bottleneck in you application.

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

Sidebar

Related Questions

Hello i have created an activity in XML code in android for 3.7 In
Hello StackOverflow :) I have created some code inside my onStart(); method to ensure
hello all I have a small dialog which I created dynamically, which has a
I have a string in linq which is loaded from xml, that attribute or
I have an XML file which will output a string: <mystring> <manipulate type=caps> <string>Hello
hello i have created one windows application in c# .net and its working fine
I have basic hello word example of Prime Faces. I have created dynamic web
I have created a Hello World web part. When I pressed F5 in Visual
I have created button 2 below: <input id=Button1 type=button value=Stop onclick=alert('hello world');/> <input id=Button2
I have created an enum as so: enum Types { hi, hello, bye }

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.