Click here to Skip to main content
12,395,593 members (59,501 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
 
GeneralRe: Damn Cookies! Pin
ahmed zahmed30-Jun-13 5:49
memberahmed zahmed30-Jun-13 5:49 
GeneralRe: Damn Cookies! Pin
BCantor1-Jul-13 8:46
memberBCantor1-Jul-13 8:46 
GeneralRe: Damn Cookies! Pin
BillWoodruff28-Jun-13 18:44
memberBillWoodruff28-Jun-13 18:44 
GeneralRe: Damn Cookies! Pin
Marc Clifton29-Jun-13 3:10
protectorMarc Clifton29-Jun-13 3:10 
BillWoodruff wrote:
Care to open the kimono a little, and mention, in general terms, how you did this.


I've only done this in Ruby on Rails because that's what I've used to write a couple websites, but I'm sure the code:

# create an authentication token if the user has clicked on remember me
   auth_token = SecureRandom.urlsafe_base64
   user.authentication_token = auth_token
   cookies.permanent[:auth_token] = auth_token

is very similar to what you can do with ASP.NET. Here, both the cookie key and its data are a random code. Now, there are also many algorithms, from simple hashing to more complex encryption, that you can use for data rather than just storing random authentication codes.

From my article: User Authentication in Ruby on Rails[^]

Marc

GeneralRe: Damn Cookies! Pin
TnTinMn29-Jun-13 2:26
memberTnTinMn29-Jun-13 2:26 
GeneralRe: Damn Cookies! PinPopular
_Maxxx_29-Jun-13 2:34
member_Maxxx_29-Jun-13 2:34 
GeneralRe: Damn Cookies! Pin
Dalek Dave29-Jun-13 2:51
memberDalek Dave29-Jun-13 2:51 
GeneralRe: Damn Cookies! Pin
TnTinMn29-Jun-13 3:02
memberTnTinMn29-Jun-13 3:02 
GeneralRe: Damn Cookies! Pin
harold aptroot29-Jun-13 2:41
memberharold aptroot29-Jun-13 2:41 
GeneralRe: Damn Cookies! Pin
TnTinMn29-Jun-13 2:59
memberTnTinMn29-Jun-13 2:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 24 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid