title: Best Method to run Subdomains in MVC4
body: <p>I have a website that is in a pre-integration phase. In other words, I have ensured that the site runs fine on my local Development Server (VS2012) utilizing the dynamically generated ASP.NET Development Server that runs at the time of debug executions; and I have now created a sub-domain of my domain on the Web Host Server and deployed my site there.</p>
  
  <p>My decision to do this was because I obviously don't want users accessing the site until it has undergone thorough testing on the actual Host. My problem is though most of the site functions without issue (including URL's), there are a few links that produce the HTTP 404 error. </p>
  
  <p>"The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly."</p>
  
  <p>It then references the View/Controller path in the context of the Error that I know exists.</p>
  
  <p>Why it only happens for certain Uri requests and not others is somewhat puzzling to me.</p>
  
  <p>So I am strongly suspecting that it has something to do with the Default Routing Configuration for MVC and I believe if I were to move the site to the main domain, the issue will likely resolve but then again, it would defeat the purpose of setting it up in the SubDomain for testing before public access.</p>
  
  <p>I need some viable options here but don't no where to start. </p>
  
  <p>Should I address the issue from the perspective of the Routing Configuration and create 2 separate Global.asax.cs files? One for the domain and the other for the subdomain testing? And if so, How should I modify the file to accomodate for the Subdomain.</p>
  
  <p>Or is there a more elegant solution for approaching the Integration process?</p>
  
  <p>----------------- UPDATE ---------------------</p>
  
  <p>So I've been troubleshooting the problem and it appears as though the 404 Error is only being generated for a method in my Controller that is returning a string. </p>
  
  <p>I have a function that is being called in my View that looks like this:</p>
  
  <pre><code>&lt;script&gt;
  function Subscribe(slvl) {
      $.ajax({
          type: 'POST',
          datatype: "text",
          data: { level: slvl },
          url: '@Url.Action("Upgrade", "Profile")',
          success: function (result) {
              if (result) {
                  window.location = result;
              }
          },
          error: function onError(result) {
                 alert(result.responseText);
              }
      });
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I cannot post the full details of the Controller but it simply returns a string and whether I were to post the entire method or a simple one, the results would be the same. So for illustration only it looks something like this.</p>
  
  <pre><code>[HttpPost]
      public string Upgrade(string level)
      {
           var uri = "http://www.someUri.com?Upgrade=" + level;
           return uri;
      }
  </code></pre>
  
  <p>This code is producing a HTTP 404 Error complaining that the path Profile/Upgrade cannot be found.</p>
  
  <p>But I've found that if I use reference to a different method being called in the same Controller with the only exception being that it returns an ActionResult to a different View, the Error goes away and I'm redirected to the alternate view.</p>
  
  <p>Any Ideas? So maybe it has nothing to do with the Subdomain???</p>