Securing the Registration Pageshttp://forums.asp.net/t/1774129.aspx/1?Securing+the+Registration+PagesMon, 27 Feb 2012 09:57:09 -050017741294852313http://forums.asp.net/p/1774129/4852313.aspx/1?Securing+the+Registration+PagesSecuring the Registration Pages <p>I am just setting out a new website that needs to be secured and I'm struggling to work out how to secure the registration pages. &nbsp;The registration process is complicated and involves them requesting a code to be posted to their address, so when they get that letter they have to come back to the website and authenticate themselves with this one off code, then continue with the registration process to setup password etc. &nbsp;I don't want to set the auth cookie before registration is complete as they will be able to get into the main part of the website without having setup a password etc, and also I don't want them to be able to register until we have checked their one off code. &nbsp;Do I need to use 2 different auth cookies? &nbsp;I haven't seen this before on other websites I've worked on and it seems wrong somehow.</p> 2012-02-27T08:21:04-05:004852350http://forums.asp.net/p/1774129/4852350.aspx/1?Re+Securing+the+Registration+PagesRe: Securing the Registration Pages <p>It depends on how you envisage your registration process to work.</p> <p>You only needto worry about the authentication cookie at the end, when everything is in order.</p> <p>So, assume you have a registration page where the user starts the process. Say your takes their name and email address. When they submit the oage, they get sent the email with the code and a link which send them to a new page called RegistrationConfirm or something like that.</p> <p>At this point they will probably get a record in the database which holds their email address , name and that one off code.</p> <p>Nothing else happens at this stage.</p> <p>When they click on the link in their confirmation email, they are sent to the second page and pass the data you need for the comfirmation in the URL as query string parameters or build a form and ask them to type their email address and one off code.</p> <p>Now you check the code and if everything is in order you allow them to continue, take their password and so on. A lot of systems log the user in once the registration process is complete. If you do the same then simply set the authentication cookie at the very last stage.</p> <p>Does that make sense ?</p> <p></p> 2012-02-27T08:39:13-05:004852369http://forums.asp.net/p/1774129/4852369.aspx/1?Re+Securing+the+Registration+PagesRe: Securing the Registration Pages <p>I think that makes sense. &nbsp;So having posted them a letter with a code on it, &nbsp;I could verify it on a non secure page, store in session that they had verified it, then allow them to setup a password on a different page but check the session variable to make sure they can only setup a password if their code was verified? &nbsp;I don't want to log them in automatically so I guess I just won't set an auth cookie at this stage.</p> <p>If they try and get to the setup password page without having been through the other page then the setup will fail because of the session variable not being set.</p> <p>Does that sound right?</p> 2012-02-27T08:46:11-05:004852423http://forums.asp.net/p/1774129/4852423.aspx/1?Re+Securing+the+Registration+PagesRe: Securing the Registration Pages <p>I don't see a problem with that, I would only use 2 pages to be honest, but if you need more than that than sure go ahead and use Session.</p> <p>Don't forget that Session can expire though, so keep that in mind as well when writing the code.</p> 2012-02-27T09:06:49-05:004852522http://forums.asp.net/p/1774129/4852522.aspx/1?Re+Securing+the+Registration+PagesRe: Securing the Registration Pages <p>Will do. &nbsp;Thanks.</p> 2012-02-27T09:57:09-05:00