title: ASP.NET MVC Site Map Provider Breaks Under Heavy Load
body: <p>I have an issue with the ASP.NET MVC Site Map provider and it is causing alot of headaches for me. The issue comes when the server is under heavy load the URL is resolved incorrectly. I have just upgraded to the latest version (3.1.0 RC) where i hoped this would be fixed but unfortunately it hasn't.</p>
  
  <p>I tried to produce a local test to verify this but i was unable to replicate the load on the server. Therefore i will show you a unit test i fire against the live server:</p>
  
  <pre><code>[TestMethod]
  public void ForumTopic_Breadcrumb() {
      // Arrange
      var isValid = true;
  
      for (var i = 0; i &lt; 100; i++) {
          try {
              // Send the request
              var request = Http.WebRequest("http://www.mysite.com/Forum/ViewTopic/38044"); // Http.WebRequest is a utility method to send a request to the server and retrieve the content (Note: now the question has been answered i have remove the reference to the actual site)
  
              // Parse the html document
              var document = new HtmlDocument(); // HTML Agility Pack
              document.LoadHtml(request.Data);
  
              // Get the required info
              var forumNode = document.DocumentNode.SelectSingleNode("//div[@id='breadcrumb']/a[@href='/Forum/ViewForum/1']");
              var topicNode = document.DocumentNode.SelectSingleNode("//div[@id='breadcrumb']/span");
  
              // Test if the info is valid
              if (forumNode == null || topicNode.InnerText != "Test Topic")
                  throw new Exception();
          } catch {
              isValid = false;
              break;
          }
      }
  
      // Asset
      Assert.IsTrue(isValid);
  }
  </code></pre>
  
  <p>This test fails as often the wrong breadcrumb and/or title is displayed.</p>
  
  <p>My ViewTopic action method has the following code in it:</p>
  
  <pre><code>// Override the parent node title and url
  SiteMap.CurrentNode.ParentNode.Title = topic.Forum.ForumName;
  SiteMap.CurrentNode.ParentNode.Url = Url.GenerateUrl("ViewForum", new { id = topic.Forum.ForumID });
  
  // Set the meta description
  SiteMap.CurrentNode["MetaDescription"] = topic.Subject;
  </code></pre>
  
  <p>Aswell as having the SiteMapTitle attribute applied to change the current nodes title to the subject of the topic.</p>
  
  <p>I'd really appreciate it if you could help. Thanks</p>