title: Handling session time out when ajax call to C# mvc controller not working
body: <p>When calling a function from ajax. Program flow does not recognized the expired session i.e not redirect to the login page. Instead of that, it saves the record. I am working in c# .net mvc. So how can i handle session while ajax call. Here i gave my codes.</p>
  
  <pre><code> $.ajax({ 
              type: "POST",
              url:'/Employee/SaveEmployee',
              data:
              {
                  Location:$("#txtLocation").val(), 
                  dateApplied:$("#txtDateApplied").val(), 
                  Status:$("#ddStatus").val(), 
                  mailCheck:$("#ddMailCheck").val(),
                  ...
                  ...
                  ... 
              },
              success: function (result) 
              {
  
              },
              error: function (msg) 
              {
              }
        });
  </code></pre>
  
  <p>Here the controller</p>
  
  <pre><code>[Authorize]
  public string SaveEmployee(string Location, string dateApplied, string Status, string mailCheck, ...)
  {
        objEmpMain.FirstName = firstName;
        objEmpMain.LastName = lastName;
        objEmpMain.Initial = Initial;
        objEmpMain.Address1 = Address;
        ...
        ... 
        ...
  } 
  </code></pre>