在asp.net中的邮件确认 [英] mail confirmation in asp.net

查看:60
本文介绍了在asp.net中的邮件确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii
我自己Somendra Chaudhary
我正在开发一个社交网站.
我想了解其中的功能
网站自动将邮件发送到用户的电子邮件
id,该邮件包含一个链接,只需单击该链接
用户重定向到网站并成为合法用户.
我想知道这背后的逻辑和编码.
请尽快回复.
谢谢

hii
myself somendra chaudhary
i am developing a social networking site.
i want to know about a functionality in which
website automatically sent a mail to user''s email
id ,that mail contain a link, on clicking that link
user redirect to website and become a legal user.
i want to know about logic behind this and coding also.
please reply soon.
Thank you

推荐答案

以下是您可能使用的逻辑:

1.如果某些相似的列尚不存在,请在用户表中添加两列ActivationKey (varchar uniqueidentifier)和Active (bit).

2.注册用户后,在发送电子邮件之前,生成GUID 并通过使用新生成的GUID设置ActivationKey 字段并将相应用户表中的Active 字段设置为false来更新用户数据. .

3.通过添加ActivationKey (GUID)作为查询字符串参数来生成链接.

4.当用户单击电子邮件中的URL链接时,使用ActivationKey (GUID)从用户表中检索用户.如果ActivationKey没有可用的用户,则显示错误消息.

5.如果ActivationKey有用户可用,并且已经激活了用户(Active = true),则显示消息,表明该用户已被激活.否则,(如果Active = false)设置Active = true ,并显示成功消息,表明用户已被激活.

基于上述逻辑,我希望您可以轻松实现主要功能.
Here is the logic you might use:

1. Add two columns ActivationKey (varchar or uniqueidentifier) and Active (bit) in the user table, if some similar columns doesn''t exist already.

2. When user is registered, before sending an email, generate a GUID and update the user data with setting the ActivationKey field with the newly generated GUID and setting the Active field to false in the corresponding user table.

3. Generate the link with adding the ActivationKey (GUID) as a Query string parameter.

4. When user clicks the URL link in the email, retrieve the user using the ActivationKey (GUID) from the user table. If no user is available with the ActivationKey, show an error message.

5. If user is available with the ActivationKey, and if user is already activated (Active = true), show message that the user has already been activated. Otherwise, (If Active = false) set Active = true and show success message that user has been activated.

Based upon the above logic, I hope it would be easy for you to implement the main functionality.


您可能需要注册过程才能收集用户数据.使用唯一的ID将每个用户保存到数据库中,然后发送电子邮件.邮件中的链接会将ID作为参数.单击链接后,您的页面将获取此ID,并将其与数据库进行比较以确认用户并允许他进入.在此过程中,出于安全目的,可能必须考虑ID的加密和过期.
You may need a sign-up process to collect user data. Save each user into database with a unique ID and then send out an email. The link in the mail would have the ID as a parameter. When the link is clicked, you page will grab this ID and compare it with you database to confirm the user and let him in. In this process, encryption and expiration of the ID may have to be considered for security purpose.


这篇关于在asp.net中的邮件确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆