Q:

Calling a Web Service using jQuery to return a simple Boolean value

I have an ASP.NET Web Forms application and on one of my .ASPX pages I have some javascript.
In one part of the Javascript, I want to call a web service so I can perform a server-side function and return either a true or false value, then in the javascript I can perform one of two actions depending on the true or false value.
I've not done any web services before and so I'm struggling with getting a simple value back to the JS.
My WebService (LoginCheck.asmx) currently looks something like this:
[System.Web.Script.Services.ScriptService]
public class LoginCheck : System.Web.Services.WebService
{
    [WebMethod]
    public bool IsLoggedIn()
    {
        return UserService.IsAuthenticated();
    }
}

My Javascript call currently looks something like this:
$.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: "LoginCheck.asmx/IsLoggedIn",
    data: "{}",
    dataType: "json",
    success: function (response) {
        if (response) {
            alert('Logged in: true');
        } else {
            alert('Logged in: false');
        }
    }
});

Despite having a breakpoint in my code on the 'IsLoggedIn' web service method, it never breaks on it. I have checked the 'console' in Google Chrome when the web service is supposed to be called and it says something along the lines of:
"The following operations are supported...", and it shows my one 'IsLoggedIn' method, but all the content rendered in this console window is essentially an HTML page, with HTML markup.
I don't appear to ever be a) breaking on the breakpoint in code or b) getting a response back to my javascript (hence neither of the js alerts shown in my code above are occurring).

A:

it's getting a 301 redirect back to the LoginCheck.asmx

I got the same problem today.
You are probably using a LowerCaseRule in the URLRewrite 2 module for IIS. 
Your method name is IsLoggedIn, so the LowerCaseRule tries to call isloggedin, which fails.
Your LowerCaseRule should ignore asmx files, like this:
        <rule name="LowerCaseRule1" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
            <conditions>
                <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml)|(asmx))$" ignoreCase="true" negate="true"/>
            </conditions>
            <action type="Redirect" url="{ToLower:{URL}}" />
        </rule>

Edit: I summed some of today's experience up and posted it here: http://www.tomot.de/en-us/article/8/asp.net/how-to-use-jquery-to-call-a-webservice-asmx-method

