Originariamente inviato da Gluck74
eeeeehhhhhh?????
ciao 
un esempio molto minimale...
codice:
//creo un servizio che funge da login
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class LoginService : ILoginService
{
//metodo da chiamare per ottenere il cookie
public bool Login(string userName, string password)
{
bool returnValue = false;
User user;
//controllo se un utente esiste nella classe statica.
//In realtà potrei anche andare a controllare tra gli utenti del db
//o tramite Membership.ValidateUser ecc.
user = DB.Users.Where(one => one.UserName == userName).FirstOrDefault();
if (user != null)
{
returnValue = (user.Password == password);
}
if (returnValue)
{
// creo il cookie
var ticket = new FormsAuthenticationTicket(
1,
userName,
DateTime.Now,
DateTime.Now.AddDays(1),
true,
user.UserID.ToString()
);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
HttpContext.Current.Response.Cookies.Add(cookie);
}
return returnValue;
}
}
public class Person
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class User
{
public int UserID { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
//funge da DB
public static class DB
{
public static List<Person> People { get; set; }
public static List<User> Users { get; set; }
static DB()
{
People = new List<Person>();
People.Add(new Person() { ID = 0, FirstName = "Mario", LastName = "Rossi" });
Users = new List<User>();
Users.Add(new User() { Password = "1234", UserID = 0, UserName = "Mario.Rossi" });
}
}
nel config :
codice:
<system.web>
....
<authentication mode="Forms">
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
<location path="LoginService.svc">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
a questo punto il client, se ha utilizzato le credenziali giuste è in possesso del cookie per accedere a tutti i servizi dell'applicazione, nel caso il login sia errato dovrebbe essere reindirizzato alla pagina "login.aspx"
spero di aver capito bene cosa ti serve 