用户注册时如何在用户的电子邮件地址上发送唯一ID [英] how to send a unique id on user's email address when user sign up...
本文介绍了用户注册时如何在用户的电子邮件地址上发送唯一ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户注册时如何在用户的电子邮件地址上发送唯一ID ...在asp.net c#
how to send a unique id on user''s email address when user sign up...in asp.net c#
推荐答案
首先创建一个唯一的使用您想要的任何ID,
您可能想要查看这个课程,
http://msdn.microsoft.com/en-us/library/system.random.aspx 一> [ ^ ]
或者正如迈克在评论中指出的那样,
- 一个SQL表的主键声明为自动递增的标识列将创建一个唯一的ID号
然后您向他们发送一封包含此唯一ID的电子邮件,
http://social.msdn.microsoft.com/Forums/en-US/ne tfxnetcom / thread / a75533eb-131b-4ff3-a3b2-b6df87c25cc8 [ ^ ]
First you create a unique ID using whatever you would like,
You might want to look into this class,
http://msdn.microsoft.com/en-us/library/system.random.aspx[^]
Or as Mike has pointed out in the comments,
- A SQL table''s Primary Key declared as an auto-incremented Identity column will create a unique id number
Then you send them an email with this unique id,
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8[^]
只需使用当前日期,时间和秒数
如下所示,严重怀疑你有多少电子邮件发送重叠秒数
Just use the current date, time and seconds
something like below, seriously doubt you have that many emails to send to overlap the seconds
Dim uniqueID as string = DateTime.now.ToString("yymmddhms")
或长度为10
or for a length of 10
private string GenerateId()
{
long i = 1, j=-1;
foreach (byte b in Guid.NewGuid().ToByteArray()){i *= ((int)b + 1);}
foreach (byte b in Guid.NewGuid().ToByteArray()) { j *= ((int)b + 1); }
var str1 = string.Format("{0:d}", (i - DateTime.Now.Millisecond));
var str2 = string.Format("{0:d}", (j - DateTime.Now.Millisecond));
return "EMC" + str1.Substring(0, 4) + str2.Substring(str2.Length/2, 3);
}
这篇关于用户注册时如何在用户的电子邮件地址上发送唯一ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文