using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Web.Security;
/// <summary>
/// Summary description for Authenticate
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class Authenticate : System.Web.Services.WebService {
    public Authenticate () {
        //Uncomment the following line if using designed components
            //InitializeComponent();
    }
    [WebMethod]
    public bool Login(string userName, string password, bool createPersistentCookie)
    {
        if (Membership.Provider.ValidateUser(userName, password))
        {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
            return true;
        }
        return false;
    }
    [WebMethod]
    public void Logout()
    {
        FormsAuthentication.SignOut();
    }
}
