private string CreateSession(string email, string password) { AuthenticationEngine authEngine = new AuthenticationEngine(); ResponseObjectForAnything responseObject = new ResponseObjectForAnything(); SessionResponseObject sessionObject = new SessionResponseObject(); string retVal = string.Empty; string session = authEngine.CreateSessionJSON(email, password, Request.ServerVariables["REMOTE_ADDR"]); responseObject = (ResponseObjectForAnything)Serializer.JSONStringToObject<ResponseObjectForAnything>(session); if (!string.IsNullOrEmpty(responseObject.ResultObjectJSON)) { sessionObject = (SessionResponseObject)Serializer.JSONStringToObject<SessionResponseObject>(responseObject.ResultObjectJSON); UserSession.LoginUserID = sessionObject.user.ID; UserSession.LoginUserEmail = sessionObject.user.EmailID; UserSession.LoginLatitude = Convert.ToString(sessionObject.user.Latitude); UserSession.LoginLongitude = Convert.ToString(sessionObject.user.Longitude); HttpCookie cookie = new HttpCookie("SessionKey"); cookie.Name = "sessionkey"; cookie.Value = sessionObject.session.SessionKey; Response.Cookies.Add(cookie); if (sessionObject.user.UserRoleID == 2) { retVal = "Expert"; UserSession.LoginUserType = "Expert"; } else { retVal = "User"; UserSession.LoginUserType = "User"; } } else if (string.IsNullOrEmpty(responseObject.ResultObjectJSON) || responseObject.ResultCode == "ERROR") { retVal = responseObject.ResultMessage; } return retVal; }