title: failed to load resource the server responded with a status of 500 (internal server error)
body: <p>I have an ajax call:</p>
  
  <pre><code>$.ajax({
           url: '@Url.Action("LoadCategory", "Home")',
           type: 'GET',
           contentType: "application/json; charset=utf-8",
           data: { fstValue: modelDDLValue },
           success: function (result) {
             // do something here
          });
  </code></pre>
  
  <p>and action method in Home Controller:</p>
  
  <pre><code>public JsonResult LoadCategory(string fstValue)
   {
        int modelId = 0;
          if (fstValue != "")
              modelId = Convert.ToInt32(fstValue);
  
          var result = unitOfWork.CategoryRepository.GetCategoriesForModel(modelId);
  
          string listUL = "&lt;ul class=\"root\"&gt;";
  
          IList&lt;SelectListItem&gt; Data = new List&lt;SelectListItem&gt;();
          foreach (Category cat in result)
          {
              listUL += "&lt;li&gt;&lt;a class='parent' href=\"javascript:void()\"&gt;" + cat.CategoryNameEng + "&lt;span class=\"value\"&gt;" + cat.Id.ToString() + "&lt;/span&gt;&lt;/a&gt;";
              Data.Add(new SelectListItem()
              {
                  Text = cat.CategoryNameEng,
                  Value = cat.Id.ToString(),
              });
  
              if (cat.SubCategories.Count() &gt; 0)
              {
                  listUL += "&lt;ul class=\"l1\"&gt;";
                  foreach (SubCategory scat in cat.SubCategories.Where(s =&gt; s.ModelId == modelId).ToList())
                  {
                      listUL += "&lt;li&gt;&lt;a class='sub' href=\"javascript:void()\"&gt;" + scat.SubCategoryNameEng + "&lt;span class=\"value\"&gt;" + "S" + scat.Id.ToString() + "&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;";
                      Data.Add(new SelectListItem()
                      {
                          Text = scat.SubCategoryNameEng,
                          Value = "S" + scat.Id.ToString(),
                      });
                  }
                  listUL += "&lt;/ul&gt;";
              }
              listUL += "&lt;/li&gt;";
          }
          listUL += "&lt;/ul&gt;";
  
          // add listUL into Data as the last element
          Data.Add(new SelectListItem() { Value = "listUL", Text = listUL });
  
       return Json(Data, JsonRequestBehavior.AllowGet); 
   }
  </code></pre>
  
  <p>But on webhost I'm always getting an error "failed to load resource the server responded with a status of 500 (internal server error)". </p>
  
  <p>I tried to replace ajax method with $.get() and other things, read all answers on this topic in stackoverflow  but no luck.</p>
  
  <p>How do I handle with this? Thanks a lot in advance!</p>