Windows窗体应用程序的C#中的新用户电子邮件验证 [英] New User Email Verification in C# for Windows Form Application

查看:70
本文介绍了Windows窗体应用程序的C#中的新用户电子邮件验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows窗体应用程序中创建新用户时,我想通过C#发送电子邮件验证链接(就像ASP.NET),然后单击该链接,在我的数据库中将IsValidated设置为true.有办法吗?

On creating a new user in a Windows Form Application, I want to send an email verification link, (just like ASP.NET) through C#, and on clicking that link, the IsValidated to be turned to true in my database. Is there a way?

推荐答案

请参阅此....
asp.net中的电子邮件验证 [
Refer this....

Email Verification in asp.net[^]


具有阅读此 CodeProject解答-[新C#中的Asp.net中的用户电子邮件验证] [

1)生成随机代码,我使用以下代码创建了六位数的随机代码以下功能:

私有int GenerateRandomCode(int最小值,int最大值)
{
随机random = new Random();
返回random.Next(min,max)
}

调用它的方式是:

..
..
int randomCode = GenerateRandomCode(100000,999999);
..
..


2)将此随机代码保存在后端的一个小表中,该表只有2个字段,用户名和代码

3)按照
此处
中的说明,使用SMTP发送此代码作为电子邮件.
4)重定向到一个表单,该表单包含一个文本框,用户可以在其中输入步骤3中邮寄的代码.

5)如果输入了正确的代码,则表明用户已成功注册并登录到Main应用程序,否则将显示一个选项,可通过以下方法重新发送代码:首先从后端的表中检索代码,然后再次使用SMTP发送代码. />
希望这会有所帮助!

Saloni
1) Generate a random code, I created a six digit random code using the following function:

private int GenerateRandomCode(int min, int max)
{
Random random = new Random();
return random.Next(min,max)
}

Called it using:

..
..
int randomCode = GenerateRandomCode(100000,999999);
..
..


2) Saved this random code in a small table in the backend with only 2 fields, username, and code

3) Sent this code as email using SMTP as explained here

4) Redirected to a form, which contains a textbox where user enters the code mailed in Step 3.

5) If correct code is entered, the user is registered successfully and logs in to the Main application, else an option to resend the code by first retrieving it from the table from the backend and then sending it again using SMTP, is displayed

Hope this helps!

Saloni


这篇关于Windows窗体应用程序的C#中的新用户电子邮件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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