ASP. NET Cookie added Delete get

Source: Internet
Author: User
Tags decrypt tojson

   Save get Cookie public class Operatorprovider {public static operatorprovider Provider {        get {return new Operatorprovider ();}        } private String loginuserkey = "LoginUser2017";        private string loginprovider = Configs.getvalue ("Loginprovider");            Public Operatormodel GetCurrent () {Operatormodel Operatormodel = new Operatormodel (); if (Loginprovider = = "Cookie") {Operatormodel = Desencrypt.decrypt (Webhelper.getcookie (loginuse Rkey). ToString ()). Toobject<operatormodel> ();//Decrypt Coookie to obtain the current logged-in user information} else {//by decrypting Session Gets the login user information Operatormodel = Desencrypt.decrypt (Webhelper.getsession (Loginuserkey). ToString ()).        Toobject<operatormodel> ();//Decrypt Coookie to obtain the current login user information} return Operatormodel; } public void Addcurrent (Operatormodel operatormodel) {if (LoginproVider = = "Cookie") {//write cookie and encrypt Webhelper.writecookie (Loginuserkey, Desencryp            T.encrypt (Operatormodel.tojson ()), 60); } else {//write session and Encrypt webhelper.writesession (Loginuserkey, DESENCR Ypt.            Encrypt (Operatormodel.tojson ())); }//Get software ID webhelper.writecookie ("Schedule_mac", Md5.md5 (Network.getmacbynetworkinterface ().            ToJson (), 32));        Webhelper.writecookie ("Schedule_licence", Licence.getlicence ()); } public void Removecurrent () {if (Loginprovider = = "Cookie") {Webhel Per.            Removecookie (Loginuserkey.trim ());            } else {webhelper.removesession (Loginuserkey.trim ()); }        }    }

  

ASP. NET Cookie added Delete get

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.