title: location.href not working on asp mvc
body: <p>I have this code ...</p>
  <pre><code>$(&quot;#Login&quot;).click(function()
   {
      var dataObject = { UserName: $(&quot;#UserName&quot;).val(), Password: $(&quot;#Password&quot;).val() };
      $.ajax({
          url: '@Url.Action(&quot;Login&quot;,&quot;User&quot;)',
          type: &quot;POST&quot;,
          data: dataObject,
          datatype: &quot;json&quot;,
          success: function (result) {
              if (result.toString() == &quot;success&quot;) {
                  alert(result);
                  window.location.href = &quot;~/Views/User/Home.cshtml&quot;;
  
              }
              else {
                  alert(result);
                  
              }
          },
          error : function(result)
          {
              alert(&quot;ERRORR&quot;)
          }
      });
  })
  </code></pre>
  <p>I'm trying to redirect to the home page ... after the success alert ... but it doesn't work. I got :</p>
  <blockquote>
  <p>Server Error in '/' Application.</p>
  <p>This type of page is not served.</p>
  <p>Description: The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.cshtml' may be incorrect.   Please review the URL below and make sure that it is spelled correctly.</p>
  </blockquote>
  <p>Any ideas ?</p>
  <p>This Is my UserController :</p>
  <pre><code>public class UserController : Controller
      {
          UserBusinessLogic UserBL = new UserBusinessLogic();
          //
          // GET: /User/
          public ActionResult Login()
          {
              return View();
          }
          [HttpPost]
          public ActionResult Login(User User)
          {
              string message = &quot;&quot;;
              if(ModelState.IsValid)
              {
                  if(UserBL.CheckUserLogin(User) &gt; 0)
                  {
                      message=&quot;success&quot;;
                      
                  }
                  else
                  {
                      message=&quot;Username or password not correct&quot;;
                  }
              }
              else
              {
                  message = &quot;All Field Required&quot;;
              }
              if (Request.IsAjaxRequest())
              {
                  return Json(message,JsonRequestBehavior.AllowGet);
              }
              else
              {
                  return RedirectToAction(&quot;Index&quot;,&quot;Home&quot;);
              }
          }
      }
  </code></pre>