comparison SilverlightExampleApp/SilverlightExampleApp.Web/Services/AuthenticationService.svc.cs @ 49:502f5f365649

Initial load for Silverlight Example Application
author Steven Hollidge <stevenhollidge@hotmail.com>
date Tue, 17 Apr 2012 17:57:52 +0100
parents
children
comparison
equal deleted inserted replaced
48:d617b54e1f47 49:502f5f365649
1 using System.ServiceModel;
2 using System.ServiceModel.Activation;
3 using System.Web.Security;
4
5 namespace SilverlightExampleApp.Web.Services
6 {
7 [ServiceContract(Namespace = "")]
8 [SilverlightFaultBehavior]
9 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
10 public class AuthenticationService
11 {
12 [OperationContract]
13 public bool Authenticate(string username, string password)
14 {
15 if (ValidateLogin(username, password))
16 {
17 FormsAuthentication.SetAuthCookie(username, false);
18 return true;
19 }
20 return false;
21 }
22
23 [OperationContract]
24 public bool LogOut()
25 {
26 FormsAuthentication.SignOut();
27 return true;
28 }
29
30 public bool ValidateLogin(string username, string password)
31 {
32 return username == "stevenh" && password == "password";
33 }
34 }
35 }