Пример #1
0
        public ActionResult Index(UserModel User)
        {
            if (ModelState.IsValid)
            {
                SetCookie(User.Login);
                return RedirectToAction("Dashboard", "Supervision");
            }

            return View();
        }
Пример #2
0
        public ActionResult Index()
        {
            UserModel User = new UserModel();

            HttpCookie cookie = HttpContext.Request.Cookies["username"];
            if (cookie != null)
            {
                string LoginUncrypt = HttpContext.Request.Cookies["username"].Value;
                User.Login = Encoding.Default.GetString(Convert.FromBase64String(LoginUncrypt));
            }
            return View("Index", User);
        }
Пример #3
0
 public HttpWebResponse GetSessionInfo(UserModel user)
 {
     try
     {
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://qcdsif.itn.ftgroup/qcbin/authentication-point/authenticate");
         request.Method = "Get";
         request.ContentType = "application/xml";
         string authInfo = user.Login + ":" + user.Password;
         authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
         request.Headers["Authorization"] = "Basic " + authInfo;
         using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
         {
             return response;
         }
     }
     catch (WebException e)
     {
         return null;
     }
 }