coerrace
asked on
VBS Runtime error 800A000D - Type mismatch
Hello i have this code:
But when I run i get this error "VBS Runtime error 800A000D - Type mismatch"
Any know why is not working or what is needed to change to make work?
Thank you
<%@ LANGUAGE="VBSCRIPT" %>
<%
Function RndStr(Length, UseChrs)
If IsNull(UseChrs) OR (UseChrs = "") Then UseChrs = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+=-"
NewStr = ""
Randomize(CByte(Left(Right(Time(),5),2)))
For gpIndex = 1 To Length
NewStr = NewStr & Mid(UseChrs, Int((Len(UseChrs)) * Rnd + 1), 1)
Next
RndStr = NewStr
End Function
%>
<HTML>
<HEAD>
<TITLE>Info</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<font face="Arial" color="#000000" size ="2">
<br>
<textarea rows="20" cols="200" STYLE="font-family: Arial; font-size: 12px; background-color: #E8E8E8; word-wrap: normal; overflow: auto;">
Cookie = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
Password = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
</textarea>
</font>
</BODY>
</HTML>
But when I run i get this error "VBS Runtime error 800A000D - Type mismatch"
Any know why is not working or what is needed to change to make work?
Thank you
What line is the error occurring?
ASKER
This area:
Cookie = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
Password = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
Try running the code directly (not through the function) that should give you a better sense where the error occurs
ASKER
I used this:
And now the error say:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CByte'
<%
If IsNull(UseChrs) OR (UseChrs = "") Then UseChrs = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+=-"
NewStr = ""
Randomize(CByte(Left(Right(Time(),5),2)))
For gpIndex = 1 To Length
NewStr = NewStr & Mid(UseChrs, Int((Len(UseChrs)) * Rnd + 1), 1)
Next
RndStr = NewStr
CookieEncryptionKey = RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")
PasswordEncryptionKey = RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")
Response.write (CookieEncryptionKey)
Response.write ("pass" & PasswordEncryptionKey)
%>
And now the error say:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CByte'
Change cbyte to cdbl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Solved