如何编写用于发送验证码的代码 [英] how to write code for sending verification code
本文介绍了如何编写用于发送验证码的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,当我注册用户时,我需要在他们各自的电子邮件中向他们发送验证码.我知道如何使用c#发送电子邮件,但如何为每个用户生成随机验证码.
In my application when I register a user I need to send them verification code on their respective email. I know the how to send email using c# but how do I generate the random verification code for every user.
推荐答案
您好,要随机创建验证码,请创建一个字符串不同字符的组合:
您可以在C#中使用Random()来使用UserName中的2-3个字符,pprocess名称中的2个字符以及4个random no,然后将所有字符组合在一起以生成完整的字符串.
使用上面的过程,告诉我是否有问题.
Hi, For Creating Varification Code Randomly, make a string of diffrent characters:
You can use 2-3 chars from UserName, 2 char of pprocess name, and 4 random no using Random() in C# and combine all chars to generate a complete string.
Use above process and tell me if there is any problem.
这篇关于如何编写用于发送验证码的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文