forms authentication - c# Update Cookie, without forcing the user to login -
forms authentication - c# Update Cookie, without forcing the user to login -
i have 'ui' setting controls appearance, user can alter setting, involves updating cookie.
i seem able update, forces user authenticate again, how can update cookie without getting user autenticate again?
//we need update usertoken menuoptionchanged var usertoken2 = new usertoken(schedule.minimisedmenubool); httpcookie cookie = formsauthentication.getauthcookie(usertoken.username, false); var ticket = formsauthentication.decrypt(cookie.value); var newticket = new formsauthenticationticket(ticket.version,ticket.name,ticket.issuedate,ticket.expiration,false,usertoken2.calculaterawtoken(),ticket.cookiepath); // encrypt ticket , store in cookie cookie.value = formsauthentication.encrypt(newticket); system.web.httpcontext.current.response.cookies.set(cookie);
why saving ui appearance preferences in authentication cookie?
is there wrong saving separate cookie?
httpcookie menucookie = new httpcookie("menucookie"); menucookie.values.add("menuappearance", schedule.minimisedmenubool); menucookie.expires = datetime.now.addyears(1); response.cookies.add(menucookie);
then can optionally parse cookie logged in users.
c# forms-authentication
Comments
Post a Comment