title: Jquery/ajax web service call get redirected (302 Object moved) and then 500 unknown webservice name
body: <p>I have been struggling with this for some times.. I searched around but didn't get a solution yet. This is only an issue on production server. In my development environment, everything works just fine.</p>
  
  <p>I am using JQuery/Ajax to update product information based on product's Color attribute. for example, a product has A and B color, the price for color A is different from color B.
  When user choose different color, the price information is updated as well.</p>
  
  <p>What I did is to first add a javascript function:
   <code>&lt;script language="javascript" type="text/javascript"&gt;</code></p>
  
  <pre><code>function updateProductVariant() {
                  var myval = jQuery("#&lt;%=colorDropDownList.ClientID%&gt;").val();
                  jQuery.ajax({
                      type: "POST",
                      url: "/Products.aspx/GetVariantInfoById",
                      data: "{variantId:'" + myval + "'}",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
  
                      success: function (response) {
                          var obj = jQuery.parseJSON(response.d);
  
                          jQuery("#&lt;%=lblStockAvailablity.ClientID%&gt;").text(obj.StockMessage);
                          jQuery(".price .productPrice").text(obj.CurrentPrice);
                          jQuery(".price .oldProductPrice").text(obj.OldPrice);
                      }
  
                  });
              }
  </code></pre>
  
  <p>Then I can register the dropdown list's 'onclick' event point to function 'updateProductVariant'</p>
  
  <pre><code>GetVariantInfoById is a Web method in the codebehind, its also very straightforward：
      [WebMethod]
          public static string GetVariantInfoById(string variantId)
          {
  
          int id = Convert.ToInt32(variantId);
  
          ProductVariant productVariant = IoC.Resolve&lt;IProductService&gt;().GetProductVariantById(id);
  
          string stockMessage = productVariant.FormatStockMessage();
  
          StringBuilder oBuilder = new StringBuilder();
  
          oBuilder.Append("{");
          oBuilder.AppendFormat(@"""{0}"":""{1}"",", "StockMessage", stockMessage);
          oBuilder.AppendFormat(@"""{0}"":""{1}"",", "OldPrice", PriceHelper.FormatPrice(productVariant.OldPrice));
          oBuilder.AppendFormat(@"""{0}"":""{1}""", "CurrentPrice", PriceHelper.FormatPrice(productVariant.Price));
          oBuilder.Append("}");
          return oBuilder.ToString();
      }
  </code></pre>
  
  <p>All these works fine on my local box, but if i upload to the production server, catching the traffic using fiddler, /Products.aspx/GetVariantInfoById becomes a 302 
  Object moved</p>
  
  <h2>Object moved to <a href="http://www.pocomaru.com/Products.aspx/GetVariantInfoById/default.aspx" rel="nofollow noreferrer">here</a>.</h2>
  
  <p></p>
  
  <p>On my local box,</p>
  
  <p>HTTP/1.1 200 OK</p>
  
  <p>Server: ASP.NET Development Server/10.0.0.0</p>
  
  <p>Date: Thu, 03 Mar 2011 09:00:08 GMT</p>
  
  <p>X-AspNet-Version: 4.0.30319</p>
  
  <p>Cache-Control: private, max-age=0
  Content-Type: application/json; charset=utf-8
  Content-Length: 117
  Connection: Close</p>
  
  <p>But when deployed on the host, it becomes
  HTTP/1.1 302 Found</p>
  
  <p>Proxy-Connection: Keep-Alive</p>
  
  <p>Connection: Keep-Alive</p>
  
  <p>Content-Length: 186</p>
  
  <p>Via: 1.1 ADV-TMG-01</p>
  
  <p>Date: Thu, 03 Mar 2011 08:59:12 GMT</p>
  
  <p>Location: <a href="http://www.pocomaru.com/Products.aspx/GetVariantInfoById/default.aspx" rel="nofollow noreferrer">http://www.pocomaru.com/Products.aspx/GetVariantInfoById/default.aspx</a></p>
  
  <p>Server: Microsoft-IIS/7.0
  X-Powered-By: ASP.NET</p>
  
  <p>then of course, then it returns 500 error title>Unknown web method GetVariantInfoById/default.aspx.<br>Parameter name: methodName</p>
  
  <p>Can someone please take a look? I think its some configuration in the production server which automatically redirects my webservice call to some other URL, but since the product server is out of my control, i am seeking a local fix for this.</p>