title: Authentication failed during call webmethod from jquery.ajx with AspNet.FriendlyUrls and AspNet.Identity
body: <p>If I call webmethod from jQuery.Ajax with installed Nuget packages Microsoft.AspNet.FriendlyUrls v 1.0.2 and Microsoft.AspNet.Identity v.1.0.0., then I get the data object, but without data.d but with property Message 'Authentication failed'.</p>
  
  <p>My Webmethod.aspx is:</p>
  
  
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
       &lt;title&gt;WebMethod&lt;/title&gt;
      &lt;script src="Scripts/jquery-2.0.3.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;h3&gt;Test Webmethod&lt;/h3&gt;
      &lt;div id="greeitng"&gt;&lt;/div&gt;
      &lt;div id="innerError" style="border:1px dotted red;display:none;" title="errorMessage"&gt;&lt;/div&gt;
      &lt;script type="text/javascript"&gt;
          function asyncServerCall(username) {
              jQuery.ajax({
                  url: 'WebMethod.aspx/HelloWorld',
                  type: "POST",
                  data: "{'username':'" + username + "'}",
                  //async: false,
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (data) {
                      if (data.d == undefined)
                          document.getElementById("greeitng").innerHTML = data.Message;
                      else
                          document.getElementById("greeitng").innerHTML = data.d;
                  },
                  error: function (err) {
                      if (err.responseText) {
                          $('#innerError').html(err.responseText).show();
                      }
                      else {
                          alert(err);
                      }
                  }
              });
          }
          $(document).ready(function () {
              $('#innerError').hide();
              asyncServerCall("Superuser");
          });
      &lt;/script&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My Webmethod in WebMethod.aspx.cs is:</p>
  
  <pre><code>[System.Web.Services.WebMethod]
  public static string HelloWorld(string username)
  {
      return string.Format("Hello, {0}", username);
  }
  </code></pre>
  
  <p>In Global.asax.cs is Routing activated </p>
  
  <pre><code>void Application_Start(object sender, EventArgs e)
  {
      RouteConfig.RegisterRoutes(RouteTable.Routes);
  }
  </code></pre>
  
  <p>In App_Start have regitred the routes</p>
  
  <pre><code>public static class RouteConfig
  {
      public static void RegisterRoutes(RouteCollection routes)
      {
          var settings = new FriendlyUrlSettings();
          settings.AutoRedirectMode = RedirectMode.Permanent;
          routes.EnableFriendlyUrls(settings);
      }
  }
  </code></pre>