public JsonNetResult UploadPhoto() // HttpPostedFileBase file) // Object file) { var length = Request.ContentLength; var bytes = new byte[length]; Request.InputStream.Read(bytes, 0, length); var response = new DataAccessResponseType(); var platformManagementServiceClient = new AccountManagementService.AccountManagementServiceClient(); JsonNetResult jsonNetResult = new JsonNetResult(); try { platformManagementServiceClient.Open(); var user = AuthenticationCookieManager.GetAuthenticationCookie(); response = platformManagementServiceClient.UpdateAccountUserProfilePhoto( user.AccountID.ToString(), user.Id, bytes, user.Id, AccountAdminSite.AccountManagementService.RequesterType.Exempt, Common.SharedClientKey); //Close the connection WCFManager.CloseConnection(platformManagementServiceClient); } catch (Exception e) { #region Manage Exception string exceptionMessage = e.Message.ToString(); var currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); string currentMethodString = currentMethod.DeclaringType.FullName + "." + currentMethod.Name; // Abort the connection & manage the exception WCFManager.CloseConnection(platformManagementServiceClient, exceptionMessage, currentMethodString); // Upate the response object response.isSuccess = false; response.ErrorMessage = WCFManager.UserFriendlyExceptionMessage; //response.ErrorMessages[0] = exceptionMessage; #endregion } jsonNetResult.Formatting = Newtonsoft.Json.Formatting.Indented; jsonNetResult.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local; //<-- Convert UTC times to LocalTime jsonNetResult.Data = response; return(jsonNetResult); }