Search code examples
c#email-validation

I don't understand how email activation works


I want to verify that the user email is valid and turn this email into his id in my system. Yet I don't know how to make a link in the mail, that activates the account like(facebook and others ) and I don't really understand what happens when the link is selected.

I thought of generating a key like "sdklbsdgk4493" to enter once- so that guessing is hard, yet for many people copy and paste is not trivial and I may annoy them with this solution.

Any thoughts or ideas?

p.s: I'm working in c# so if it can be done with c#... it will be great :)

Thanks Asaf


Solution

  • When you insert a new user in the Database, their status should be "Deactivated" and you insert a "GUID" you generate alongside. You send them a link to your activation Page which would contain this GUID in the Query String. It will look like this:

    www.YourSite.com/Activation.aspx?GUID=jdfhg43h98234

    In the Activation.aspx page, you take this GUID from the Query String and compare it to the one you have in the Database. You then activate the Account having that GUID.