Beispiel #1
0
        public async void LoginClicked()
        {
            var formcontent = MakeFormContent();

            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.PostAsync(Resources.APIPrefix + Resources.LoginURI, formcontent);

            var status = response.StatusCode;

            if (status == HttpStatusCode.Found)
            {
                var URI          = Resources.APIPrefix + Resources.GetUserByUserNameURI + Email;
                var Userresponse = await client.GetStringAsync(URI);

                var User = JSONConversion.DeserializeResponseToModel <Users>(Userresponse);

                AppSettings.AddOrUpdateValue(Resources.UserName, User.Email);
                AppSettings.AddOrUpdateValue(Resources.UserFirstName, User.FirstName);
                AppSettings.AddOrUpdateValue(Resources.UserFullName, User.FirstName + " " + User.LastName);
                AppSettings.AddOrUpdateValue(Resources.UserPhone, CryptoEngine.Decrypt(User.Phone, Resources.CryptoKey));
                AppSettings.AddOrUpdateValue(Resources.UserId, User.UserId.ToString());

                Application.Current.MainPage = new MainPage();
            }
            else
            {
                DependencyService.Get <IMessage>().LongAlert(Resources.WrongCredentials);
            }
        }
        public static string GetConnectionString()
        {
            var connString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

            var connectionString = CryptoEngine.Decrypt(connString);

            return(connectionString);
        }
Beispiel #3
0
 private void GetEmailParms()
 {
     oProv.Host     = CryptoEngine.Decrypt(ConfigurationManager.AppSettings["Host"], "sblw-3hn8-sqoy19");
     oProv.Port     = Int32.Parse(CryptoEngine.Decrypt(ConfigurationManager.AppSettings["Port"], "sblw-3hn8-sqoy19"));
     oProv.PWD      = CryptoEngine.Decrypt(ConfigurationManager.AppSettings["PWD"], "sblw-3hn8-sqoy19");
     oProv.User     = CryptoEngine.Decrypt(ConfigurationManager.AppSettings["User"], "sblw-3hn8-sqoy19");
     oEmail.Subject = ConfigurationManager.AppSettings["Subject"];
 }
        public ActionResult LoginSubmit(USER_MASTER objUSER_MASTER)
        {
            USER_MASTERs objUSER_MASTERs = new USER_MASTERs();

            string str         = objUSER_MASTER.EMAIL_ID;
            string email_id    = "";
            string mobile_no   = "";
            string decryptPass = "";
            String Msg         = "";

            try
            {
                if (string.IsNullOrEmpty(objUSER_MASTER.EMAIL_ID))
                {
                    Msg = "Please enter EmailId/Mobile number";
                }
                if (string.IsNullOrEmpty(objUSER_MASTER.PASSWORD))
                {
                    Msg = "Please Enter the password";
                }
                if (Msg == "")
                {
                    if (str.Contains("@"))
                    {
                        email_id = objUSER_MASTER.EMAIL_ID;
                    }
                    else
                    {
                        mobile_no = objUSER_MASTER.EMAIL_ID;
                    }

                    objUSER_MASTERs.LogInUser(email_id, mobile_no, "");
                    decryptPass = CryptoEngine.Decrypt(objUSER_MASTERs[0].PASSWORD, "sblw-3hn8-sqoy19");

                    if (objUSER_MASTERs.Count > 0)
                    {
                        if (objUSER_MASTERs[0].ACTIVE == "Y" && objUSER_MASTER.PASSWORD == decryptPass)
                        {
                            return(View("~/Views/Home/Index.cshtml"));
                        }
                    }

                    else
                    {
                        ViewBag.Message = "Invalid UserId/Password";
                    }
                }
                else
                {
                    ViewBag.Message = Msg;
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            return(View("~/Views/LogIn/LogIn.cshtml", objUSER_MASTER));
        }
 private void fillUserInfo()
 {
     txtUserName.Text           = _user.UserName;
     txtFirstName.Text          = _user.FirstName;
     txtLastName.Text           = _user.LastName;
     txtPassword.Text           = CryptoEngine.Decrypt(_user.Password);
     lblConfirmPassword.Visible = false;
     txtConfirmPassword.Visible = false;
 }
Beispiel #6
0
 private void FrmUsuariosModificar_n_Load(object sender, EventArgs e)
 {
     CargaComboRoles();
     txtNombreA.Text     = Usuario.Nombre;
     txtApellido1A.Text  = Usuario.Apellido;
     txtContrasenaA.Text = aux.Decrypt(Usuario.Contrasena);
     txtDireccionA.Text  = Usuario.Direccion;
     txtCorreoA.Text     = Usuario.Correo;
     txtTelefonoA.Text   = Usuario.Telefono;
     txtCedulaA.Text     = Usuario.Cedula.ToString();
 }
        public ActionResult ResetPassword(string token)
        {
            if (token == null || (UserRepository.Get(CryptoEngine.Decrypt(token).Tolong()) == null))
            {
                ViewBag.Heading      = "Invalid url";
                ViewBag.ErrorMessage = "Request page not found";
                return(View("Error"));
            }

            return(View());
        }
Beispiel #8
0
    public bool isValidPassword(string passUser, int idUsuario)
    {
        CryptoEngine cryptoEngine  = new CryptoEngine();
        string       passDecrypted = cryptoEngine.Decrypt(passUser);
        bool         valid         = false;

        if (this.GetUsuario(idUsuario).Contrasena.Equals(passDecrypted))
        {
            valid = true;
        }
        return(valid);
    }
Beispiel #9
0
        /// <summary>
        /// Handles the Click event of the btnRegister control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            var ss = new IrisSession()
            {
                Username           = EdUserName.Text,
                AuthenticationMode = AuthenticationMode.Native,
                AccountId          = EdUserName.Text
            };

            Request        = RegisterNewUserDialog.Execute(ss);
            EdPwd.Password = CryptoEngine.Decrypt(Request.Password);
        }
Beispiel #10
0
    private void Start()
    {
        xpPoint = 0;
        string xpStringEncrypted = PlayerPrefs.GetString(XP_COIN_SAVE, "");

        if (xpStringEncrypted != "")
        {
            string xpStringDecrypted = CryptoEngine.Decrypt(xpStringEncrypted, XP_ENCRYPTION_KEY);
            xpPoint = Int32.Parse(xpStringDecrypted);
        }
        //Debug.Log(xpPoint);
        OnXPUpdateAction?.Invoke();
    }
        public ActionResult EnviarCorreo(int Id)
        {
            CuentaPopupViewModel model = new CuentaPopupViewModel();

            using (var db = new SaludOcupacionalEntities())
            {
                Cuenta oCuenta = db.Cuenta.Find(Id);
                model.password = CryptoEngine.Decrypt(oCuenta.contrasena);
                model.nombre   = oCuenta.nombre;
            }

            return(View(model));
        }
Beispiel #12
0
        private static MasterStore GetLocalMasterStore()
        {
            string masterPath = FilePath + "master-store.json";

            if (File.Exists(masterPath))
            {
                using (var reader = new StreamReader(masterPath, Encoding.UTF8))
                {
                    string result = reader.ReadToEnd();
                    result = CryptoEngine.Decrypt(result, SymmetricKey);
                    return(JsonConvert.DeserializeObject <MasterStore>(result));
                }
            }
            return(null);
        }
Beispiel #13
0
        private static CurrentUser GetLocalUser()
        {
            var userPath = FilePath + ValidatedUserJson;

            if (!File.Exists(userPath))
            {
                return(null);
            }
            using (var reader = new StreamReader(userPath, Encoding.UTF8))
            {
                var result = reader.ReadToEnd();
                result = CryptoEngine.Decrypt(result, Keys.SymmetricKey);
                return(JsonConvert.DeserializeObject <CurrentUser>(result));
            }
        }
        public IActionResult AddPhoto(Photos NewPhoto)
        {
            // int? y=HttpContext.Session.GetInt32("userid");
            // if (y==null){
            //     return RedirectToAction("Index");
            // }
            // bool Exists=dbContext.users.Any(e=>e.UserId==(int)y);
            // if(Exists==false){
            //     return RedirectToAction("Index");
            // }
            if (ModelState.IsValid)
            {
                CryptoEngine Encrypter = new CryptoEngine();
                NewPhoto.Desc      = Encrypter.Encrypt(NewPhoto.Desc);
                NewPhoto.PhotoPath = Encrypter.Encrypt(NewPhoto.PhotoPath);
                // NewPhoto.CreatorId=Encrypter.Encrypt((string)NewPhoto.CreatorId);
                dbContext.photos.Add(NewPhoto);
                dbContext.SaveChanges();
                return(RedirectToAction("Success"));
            }
            else
            {
                // ViewBag.UserId=(int)y;
                ViewBag.UserId = 5;

                List <Photos> Allphoto = dbContext.photos.ToList();
                foreach (var photo in Allphoto)
                {
                    CryptoEngine Encrypter = new CryptoEngine();
                    photo.Desc      = Encrypter.Decrypt(photo.Desc);
                    photo.PhotoPath = Encrypter.Decrypt(photo.PhotoPath);
                }
                ViewBag.AllPhotos = Allphoto;
                return(View("Success"));
            }
        }
Beispiel #15
0
        private static CurrentUser GetLocalUser()
        {
            string userPath = FilePath + "validated-user.json";

            if (File.Exists(userPath))
            {
                using (var reader = new StreamReader(userPath, Encoding.UTF8))
                {
                    string result = reader.ReadToEnd();
                    result = CryptoEngine.Decrypt(result, SymmetricKey);
                    return(JsonConvert.DeserializeObject <CurrentUser>(result));
                }
            }
            return(null);
        }
Beispiel #16
0
 private void btnDecrypt_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCypher.Text != string.Empty)
         {
             //Key shpuld be same for encryption and decryption
             //string key = "sblw-xyz-" + _machineName;
             string decryptPadded = CryptoEngine.Decrypt(txtCypher.Text, _cypherText);
             txtDecript.Text = decryptPadded.Replace(_machineName, "");
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #17
0
        private static MasterStore GetLocalMasterStore()
        {
            var masterPath = FilePath + MasterStoreJson;

            if (!File.Exists(masterPath))
            {
                return(null);
            }

            using (var reader = new StreamReader(masterPath, Encoding.UTF8))
            {
                var result = reader.ReadToEnd();
                result = CryptoEngine.Decrypt(result, Keys.SymmetricKey);
                return(JsonConvert.DeserializeObject <MasterStore>(result));
            }
        }
 public ActionResult <Response> Post([FromBody] User user)
 {
     try
     {
         user.Password = CryptoEngine.Encrypt(user.Password, "sblw-3hn8-sqoy19");
         appDbContext.Users.Add(user);
         appDbContext.SaveChangesAsync();
         user.Password = CryptoEngine.Decrypt(user.Password, "sblw-3hn8-sqoy19");
         return(new Response(user, 200, "User Inserted Successfully"));
     }
     catch (Exception ex)
     {
         logger.LogError(ex, user.ToString());
         return(new Response(null, 404, ex.Message));
     }
 }
Beispiel #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (plaintext.Text != string.Empty)
            {
                var key = GetKey();
                MessageBox.Show(key);
                //Here key is of 128 bit
                //Key should be either of 128 bit or of 192 bit
                label1.Text = CryptoEngine.Encrypt(plaintext.Text, key);


                if (label1.Text != string.Empty)
                {
                    //Key shpuld be same for encryption and decryption
                    label2.Text = CryptoEngine.Decrypt(label1.Text, key);
                }
            }
        }
Beispiel #20
0
    /// <summary>
    /// When failed to save coin data in server it will save data in local store
    /// </summary>
    /// <param name="actionType"> 0 for ADDITION, 1 for DEDUCTION</param>
    /// <param name="_gameType"></param>
    /// <param name="coinIndex"></param>
    public void OnAddCoinFailed(string coinIndex)
    {
        //Crashlytics.Log("CoinSystemUtilities.cs|OnAddCoinFailed(string coinIndex) : Saving coin Index offline which are failed to save in server");
        string coinDataOffline0 = PlayerPrefs.GetString(COIN_DATA_ADD_OFFLINE, "");

        string coinDataOffline = "";

        if (coinDataOffline0 != "")
        {
            coinDataOffline = CryptoEngine.Decrypt(coinDataOffline0, COIN_ENCRYPTION_KEY);
        }
        coinDataOffline += coinIndex;

        string coinDataEncrypted = CryptoEngine.Encrypt(coinDataOffline, COIN_ENCRYPTION_KEY);

        PlayerPrefs.SetString(COIN_DATA_ADD_OFFLINE, coinDataEncrypted);

        Debug.Log("COIN_DATA_ADD_OFFLINE: " + PlayerPrefs.GetString(COIN_DATA_ADD_OFFLINE, ""));
    }
Beispiel #21
0
    public void CheckForSavedCoinData()
    {
        // PlayfabController.Instance.GetAllVirtualCurrency();
        //Crashlytics.Log("CoinSystemUtilities.cs|CheckForSavedCoinData() : Checking for offline coin data...........");
        string addOfflineCoinDataList0 = PlayerPrefs.GetString(COIN_DATA_ADD_OFFLINE, "");

        string addOfflineCoinDataList = "";

        if (addOfflineCoinDataList0 != "")
        {
            addOfflineCoinDataList = CryptoEngine.Decrypt(addOfflineCoinDataList0, COIN_ENCRYPTION_KEY);
        }

        if (addOfflineCoinDataList != "")
        {
            PlayfabController.Instance.AddOfflineCoinsToServer(addOfflineCoinDataList,
                                                               () =>
            {
                //Crashlytics.Log("CoinSystemUtilities.cs|CheckForSavedCoinData()-> PlayfabController.Instance.AddOfflineCoinsToServer() : winning offline coin data added to the server sucessfully!!!");
                PlayerPrefs.DeleteKey(COIN_DATA_ADD_OFFLINE);
            });
        }

        string deductOfflineCoinDataList0 = PlayerPrefs.GetString(COIN_DATA_DEDUCT_OFFLINE, "");

        string deductOfflineCoinDataList = "";

        if (deductOfflineCoinDataList0 != "")
        {
            deductOfflineCoinDataList = CryptoEngine.Decrypt(deductOfflineCoinDataList0, COIN_ENCRYPTION_KEY);
            Debug.Log(" deductOfflineCoinDataList : " + deductOfflineCoinDataList);
        }
        if (deductOfflineCoinDataList != "")
        {
            PlayfabController.Instance.DeductOfflineCoinsToServer(deductOfflineCoinDataList,
                                                                  () =>
            {
                //Crashlytics.Log("CoinSystemUtilities.cs|CheckForSavedCoinData()-> PlayfabController.Instance.DeductOfflineCoinsToServer() : loosing offline coin data deducted from the server sucessfully!!!");
                PlayerPrefs.DeleteKey(COIN_DATA_DEDUCT_OFFLINE);
            });
        }
    }
 public ActionResult <Response> Post([FromBody] User user)
 {
     try
     {
         var fetched_user = appDbContext.Users.SingleOrDefaultAsync(p => p.Email == user.Email);
         if (fetched_user.Result != null && user.Password == CryptoEngine.Decrypt(fetched_user.Result.Password, "sblw-3hn8-sqoy19"))
         {
             HttpContext.Session.SetString("is_login", "true");
             HttpContext.Session.SetString("userid", fetched_user.Result.Id.ToString());
             return(new Response(null, 200, "Login Successfully"));
         }
         else
         {
             return(new Response(null, 200, "Login Failed"));
         }
     }
     catch (Exception ex)
     {
         logger.LogError(ex, user.ToString());
         return(new Response(null, 404, ex.Message));
     }
 }
Beispiel #23
0
        public ActionResult ConfirmEmail(string token)
        {
            if (token == null)
            {
                ViewBag.Heading      = "Invalid url";
                ViewBag.ErrorMessage = "Request page not found";
                return(View("Error"));
            }

            var activated = UserRepository.ActivateAccount(CryptoEngine.Decrypt(token).Tolong());

            if (activated)
            {
                return(View("ConfirmEmail"));
            }
            else
            {
                ViewBag.Heading      = "Invalid url";
                ViewBag.ErrorMessage = "Request page not found";
                return(View("Error"));
            }
        }
Beispiel #24
0
    public void OfflineXPSave(int amount)
    {
        string xpDataOffline0 = PlayerPrefs.GetString(XP_COIN_SAVE_OFFLINE, "");

        int    xpDataInt     = 0;
        string xpDataOffline = "";

        if (xpDataOffline0 != "")
        {
            xpDataOffline = CryptoEngine.Decrypt(xpDataOffline0, XP_ENCRYPTION_KEY);
            Debug.Log(XP_ENCRYPTION_KEY);
            xpDataInt = Int32.Parse(xpDataOffline);
        }

        xpDataInt += amount;
        string xpDataOffline1 = xpDataInt.ToString();

        string xpDataEncrypted = CryptoEngine.Encrypt(xpDataOffline1, XP_ENCRYPTION_KEY);

        PlayerPrefs.SetString(XP_COIN_SAVE_OFFLINE, xpDataEncrypted);

        Debug.Log("XP_POINT_SAVE_OFFLINE: " + PlayerPrefs.GetString(XP_COIN_SAVE_OFFLINE, ""));
    }
Beispiel #25
0
    public void CheckOfflineXP()
    {
        string offlineXP0 = PlayerPrefs.GetString(XP_COIN_SAVE_OFFLINE, "");

        string offlineXP = "";

        if (offlineXP0 != "")
        {
            offlineXP = CryptoEngine.Decrypt(offlineXP0, XP_ENCRYPTION_KEY);
        }

        if (offlineXP != "")
        {
            int offlineXPInt = Int32.Parse(offlineXP);

            PlayfabController.Instance.Add_XP_Offline(offlineXPInt,
                                                      () =>
            {
                PlayerPrefs.DeleteKey(XP_COIN_SAVE_OFFLINE);
                //Crashlytics.Log("XP_System|CheckOfflineXP()-> PlayfabController.Instance.Add_XP_Offline() :  offline xp data added to the server sucessfully!!!");
            });
        }
    }
        public IActionResult Success()
        {
            // Get;
            Chilkat.PublicKey pubKey = new Chilkat.PublicKey();
            bool success             = pubKey.LoadFromFile("qa_data/pem/rsa_public.pem");

            Chilkat.Jwt jwt = new Chilkat.Jwt();

            string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";

            //  First verify the signature.
            bool sigVerified = jwt.VerifyJwtPk(token, pubKey);

            Console.WriteLine("verified: " + Convert.ToString(sigVerified));

            int  leeway     = 60;
            bool bTimeValid = jwt.IsTimeValid(token, leeway);

            Console.WriteLine("time constraints valid: " + Convert.ToString(bTimeValid));

            //  Now let's recover the original claims JSON (the payload).
            string payload = jwt.GetPayload(token);

            //  The payload will likely be in compact form:
            Console.WriteLine(payload);

            //  We can format for human viewing by loading it into Chilkat's JSON object
            //  and emit.
            Chilkat.JsonObject json = new Chilkat.JsonObject();
            success          = json.Load(payload);
            json.EmitCompact = false;
            Console.WriteLine(json.Emit());

            //  We can recover the original JOSE header in the same way:
            string joseHeader = jwt.GetHeader(token);

            //  The payload will likely be in compact form:
            Console.WriteLine(joseHeader);

            //  We can format for human viewing by loading it into Chilkat's JSON object
            //  and emit.
            success          = json.Load(joseHeader);
            json.EmitCompact = false;
            Console.WriteLine(json.Emit());
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            // JwtDecode Test1=new JwtDecode();
            // var x=Test1.GetName("eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJJU1MiLCJzY29wZSI6Imh0dHBzOi8vbGFyaW0uZG5zY2UuZG91YW5lL2NpZWxzZXJ2aWNlL3dzIiwiYXVkIjoiaHR0cHM6Ly9kb3VhbmUuZmluYW5jZXMuZ291di5mci9vYXV0aDIvdjEiLCJpYXQiOiJcL0RhdGUoMTQ2ODM2MjU5Mzc4NClcLyJ9");
            // // var x= Test1.TestJwtSecurityTokenHandler("CfDJ8JJa5feBk79Hq8LMUg4HHXfoWI4CgZu7vOhujmhfwtEi7rYOFiVzoUBGec1HXm2aOD69Q8AEqARSHvCmyUJAw_opdjsSfIhJS3v-Dbe0MsLw8QvdMMOuNeqEZvB93lH03TM62plyHreR5_D_G7kkvJvg5vaMUOd_GgZMRFkLMlrrcrPM8l2jOVOgD1r4WIEr0oCm9KB_T0Bt5vZ37CnPJJt7r6_yVM5yuAZU3aI92S5EYodHHhVe_OjRDqg1nALC2a2KzHbGnBKfO-7FbyocHU0QRdkl5F5VBRJVsHHNMOZJ3jUhtfflSggP_b5Imk0qNcs39rEUUC8ajLUv3zaFxaCTX6yyj-kqYg2JKYFSw7OXQZl_XiNlB2mY9cdb1xjjpbLM4SxWzB8k1rMMkXETK1ZLFpu9DUiDgoKmTqICaduGdETRjvBsVA4fa2H2ztmNWCEL7huxL41rXjYb4jXSosJ6wLpjFp2j9f1oLymvPVKeeZ_aKaxFHIJF_dUnG-nIuPUtCSAexfp4NLiWaR3ctWvQ4NKeRv-UwaBoSrSt_gSJ3QAqafrmu-vTdwIek6xPb9AWTUAC7TWCgIHgz3pQqJKnPteVWgXXsPSizg2FlcWc5kYTa0PV2kf8g7JYKHPbYPkbjDKUAiYoOG4AkFdV5z6febxVZiC4XQZLM3tZHCBUdTaFHJOwUSOX8aWna-BJBA");
            // // var x= Test1.TestJwtSecurityTokenHandler();
            // System.Console.WriteLine(x);
            // var jwt = "eyJhbGciOiJQUzM4NCIsImtpZCI6ImJpbGJvLmJhZ2dpbnNAaG9iYml0b24uZXhhbXBsZSJ9.SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IHlvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBkb24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcmUgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4.cu22eBqkYDKgIlTpzDXGvaFfz6WGoz7fUDcfT0kkOy42miAh2qyBzk1xEsnk2IpN6-tPid6VrklHkqsGqDqHCdP6O8TTB5dDDItllVo6_1OLPpcbUrhiUSMxbbXUvdvWXzg-UD8biiReQFlfz28zGWVsdiNAUf8ZnyPEgVFn442ZdNqiVJRmBqrYRXe8P_ijQ7p8Vdz0TTrxUeT3lm8d9shnr2lfJT8ImUjvAA2Xez2Mlp8cBE5awDzT0qI0n6uiP1aCN_2_jLAeQTlqRHtfa64QQSUmFAAjVKPbByi7xho0uTOcbH510a6GYmJUAfmWjwZ6oD4ifKo8DYM-X72Eaw";
            // var handler = new JwtSecurityTokenHandler();
            // var token = handler.ReadJwtToken(jwt);
            // System.Console.WriteLine(token);

            System.Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
            // int? y=HttpContext.Session.GetInt32("userid");
            CryptoEngine Encrypter = new CryptoEngine();

            // if (y==null){
            //     return RedirectToAction("Index");
            // }
            // bool Exists=dbContext.users.Any(e=>e.UserId==(int)y);
            // if(Exists==false){
            //     return RedirectToAction("Index");
            // }
            // ViewBag.UserId=(int)y;
            ViewBag.UserId = 5;

            List <Photos> Allphoto = dbContext.photos.ToList();

            foreach (var photo in Allphoto)
            {
                photo.Desc      = Encrypter.Decrypt(photo.Desc);
                photo.PhotoPath = Encrypter.Decrypt(photo.PhotoPath);
            }
            ViewBag.AllPhotos = Allphoto;
            return(View());
        }