Make sure you are using the correct namespaces.
Make sure you are using the correct namespaces. I noticed two small typos in the code that you pasted: if(name=="John" && password = "123") Should be: if (name=="John" && password == "123") retrurn user; Should be: return user; Otherwise, it compiles without errors for me. Create a new Web Application Add a reference to System.ServiceModel.DomainServices.
Hosting (ex. From "C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Server\System.ServiceModel.DomainServices.Hosting. Dll") Add a reference to System.ServiceModel.DomainServices.
Server (ex. From "C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Server\System.ServiceModel.DomainServices.Server. Dll") Create a class called CustomAuthenticationService and insert the code below.
Using System.ServiceModel.DomainServices. Hosting; using System. Web; using System.Web.
Security; using System; using System.Security. Principal; using System.ServiceModel.DomainServices. Server; using System.ServiceModel.DomainServices.Server.
ApplicationServices; namespace WebApplication1. Services { public class UserDTO : UserBase { public string DisplayName { get; set; } public string Email { get; set; } } public class FormsAuthenticationLogonException : System. Exception { public FormsAuthenticationLogonException(string message) : base(message) { } } // TODO: Create methods containing your application logic.
EnableClientAccess() public abstract class FormsAuthenticationService : DomainService, IAuthentication where TUser : UserBase { protected abstract TUser GetCurrentUser(string name, string userData); protected abstract TUser ValidateCredentials(string name, string password, string customData, out string userData); protected virtual TUser GetDefaultUser() { return null; } public TUser GetUser() { IPrincipal currentUser = ServiceContext. User; if ((currentUser! = null) && currentUser.Identity.
IsAuthenticated) { FormsIdentity userIdentity = currentUser. Identity as FormsIdentity; if (userIdentity! = null) { FormsAuthenticationTicket ticket = userIdentity.
Ticket; if (ticket! = null) { return GetCurrentUser(currentUser.Identity. Name, ticket.
UserData); } } } return GetDefaultUser(); } public TUser Login(string userName, string password, bool isPersistent, string customData) { string userData; TUser user = ValidateCredentials(userName, password, customData, out userData); if (user! = null) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(/* version */ 1, userName, DateTime. Now, DateTime.Now.
AddMinutes(30), isPersistent, userData, FormsAuthentication. FormsCookiePath); string encryptedTicket = FormsAuthentication. Encrypt(ticket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.
FormsCookieName, encryptedTicket); HttpContextBase httpContext = (HttpContextBase)ServiceContext. GetService(typeof(HttpContextBase)); httpContext.Response.Cookies. Add(authCookie); } else { HttpContextBase httpContext = (HttpContextBase)ServiceContext.
GetService(typeof(HttpContextBase)); httpContext. AddError(new FormsAuthenticationLogonException("Username or password is not correct. ")); } return user; } public TUser Logout() { FormsAuthentication.SignOut(); return GetDefaultUser(); } public void UpdateUser(TUser user) { throw new NotImplementedException(); } } // TODO: Create methods containing your application logic.
EnableClientAccess() public class CustomAuthenticationService : FormsAuthenticationService { protected override UserDTO GetCurrentUser(string name, string userData) { return new UserDTO { DisplayName = name, Name = name }; } protected override UserDTO ValidateCredentials(string name, string password, string customData, out string userData) { userData = null; UserDTO user = null; if (name == "John" && password == "123") { userData = name; user = new UserDTO { DisplayName = name, Email = "asdf" }; } return user; } } }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.