asp.net

位置:IT落伍者 >> asp.net >> 浏览文章

asp.net生成6位随机码


发布日期:2024年06月09日
 
asp.net生成6位随机码
C#代码

<%@ Page Language=C# %>

<%

// 随机密码开始

ArrayList MyArray = new ArrayList()

Random random = new Random()

string str = null;

//循环的次数

int Nums = ;

while (Nums >

{

int i = randomNext(

// if (!MyArrayContains(i))

// {

if (MyArrayCount <

{

MyArrayAdd(i)

}

// }

Nums = ;

}

for (int j = ; j <= MyArrayCount ; j++)

{

str += MyArray[j]ToString()

}

// 随机密码结束

ResponseWrite(str + my array count > + MyArrayCount)

%>

<%@ Page Language=C# %>

<%

// 随机密码开始

ArrayList MyArray = new ArrayList()

Random random = new Random()

string str = null;

//循环的次数

int Nums = ;

while (Nums >

{

int i = randomNext(

// if (!MyArrayContains(i))

// {

if (MyArrayCount <

{

MyArrayAdd(i)

}

// }

Nums = ;

}

for (int j = ; j <= MyArrayCount ; j++)

{

str += MyArray[j]ToString()

}

// 随机密码结束

ResponseWrite(str + my array count > + MyArrayCount)

%>

asp的位随机数字的代码

Asp代码

<%

随机密码开始

Randomize

FreeMember=Int(( * Rnd) + 方法

Function makePassword(maxLen) 方法生成的随机码包含字母

Dim strNewPass

Dim whatsNext upper lower intCounter

Randomize

For intCounter = To maxLen

whatsNext = Int(( + ) * Rnd +

If whatsNext = Then

character

upper =

lower =

Else

upper =

lower =

End If

strNewPass = strNewPass & Chr(Int((upper lower + ) * Rnd + lower))

Next

makePassword = strNewPass

End Function

FreeMember = makePassword(

随机密码结束

FreeMember = int((+)*RND+方法

ResponseWrite FreeMember & my array count > &len(FreeMember)

%>

               

上一篇:如何在ASP.Net Ajax中调用WebService

下一篇:用ASP.NET建立一个在线RSS新闻聚合器