Want to Create a random password and mail it to the person who tried to register at your site? Here is a quick and easy example of how to do this task. It is fairly straight forward.
<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<% username="New User Name"
mailid="user@ursite.com"
address="address"
'other data like phone number as per the member database in the site
'all these values are obtained from the request method from a .htm which submits to this
file
'Mainly employed in registration
'Assumes You have cdonts.dll installed in the web server.
set conn = server.CreateObject("adodb.connection")
conn.Open "dsn","uid","pwd"
set rec= conn.Execute("select count(*) from membertable")
id = cint(rec.fields(0))+1
r=rnd *50
Response.Write r & "<br>"
for i = 0 to 20
if cint(r)>0 and cint(r)<26 then str=str +chr(97 + cint(r))
r=rnd *100
next
Response.Write str
pwd=left(str,2)
pwd=pwd & id
pwd=pwd & right(str,2)
pwd=pwd & second(time)
%>
<br>
<%
set mail= server.CreateObject("cdonts.newmail")
mail.subject="Thank You for Registering"
mail.to = mailid
mail.from ="Webmaster@thesite"
mail.body= "This is the Initial Password to our site...." & vbcrlf & "Change it if You Want" &
vbcrlf & pwd & vbcrlf & "Thank You for Using the Site"
mail.send
%>
The New Password has been Mailed.
</BODY>
</HTML>
Of course the COM object we have decided to use is CDONTS, but others would also work just as easily!
About the Author
Manikantan Vedachalam has been working as a vb programmer since 1998 and is now a web developer
at 3rdagenda in Chennai,India. Manikantan may be reached at manikantan@3rdagenda.com.
Built around the Microsoft CryptoAPI, AspEncrypt helps you harness all major encryption and hashing algorithms such as DES, Triple-DES, RC2, RC4, RSA, MD5 and SHA1 in just a few lines of code. The component can be used in tandem with AspEmail to send encrypted and signed mail in the industry-standard S/MIME format, or with AspUpload to encrypt files as they are being uploaded. AspEncrypt can also be used to issue and manage X.509 digital certificates.
AspPDF is an ASP/ASP.NET component which enables generation and management of documents in PDF format. Features include advanced text formatting, font embedding, form fill-in, images, tables, content and page extraction, document stitching, encryption, digital signatures, and more.
In many web applications it is desirable for both intranet users and external parties to be able to seamlessly log onto the system. The problem this raises is that it is not easy to allow intranet users to log in via Windows integrated authentication while also allowing external parties to log in to the same application using standard forms authentication. This article will show you one way to achieve the best of both worlds when it comes to authentication. [Read This Article][Top]
In this article, Michele Leroux Bustamante discusses authentication, authorization and role-based security in .NET. Along the way, he provides some best practices for implementing role-based security in some typical .NET application scenarios including rich clients, Web applications, and Web services. [Read This Article][Top]
When implementing custom components that require access to restricted resources, implicit impersonation must be used. Jay Nathan shows how to create a class that makes using .NET Impersonation a snap. [Read This Article][Top]
Learn about the execution process of CLR-based programs and how to protect your applications from being easily disassembled back into source code. [Read This Article][Top]
Businesses that utilize encrypted e-mail may find Secure Multipurpose Internet Mail Extensions (S/MIME) to be somewhat restrictive. This article shows how to use security features in PDF as an alternative to S/MIME. [Read This Article][Top]
Bill Gates, in a recent interview, predicted the end of spam by 2006. One of the methods he mentioned involved a challenge only a real live person could handle. Adnan Masood shows how to use AI and .NET to create a user verification scheme that incorporates similar concepts Gates alluded to.
[Read This Article][Top]
Code Access Security (CAS) is the .NET Framework security model that grants
code permission to resources based on "evidence" pertaining to the
encapsulating assembly. In this article, David Myers examines CAS
and explains different configuration methods. [Read This Article][Top]
Zhenlei Cai combines an open source C++ encryption library with SQL Server
extended stored procedures to create a platform neutral, transparent
encryption solution that resides at the database layer. [Read This Article][Top]
Christopher Spann offers a .NET configuration tip that should help ease system administrators' fears of security compromise and thus assuage growing developer demand for a .NET environment. [Read This Article][Top]
You don't have to be a cryptography expert or spend lots of money on third-party components to secure sensitive data in .NET. In this article, Wayne Plourde shows just how easy it is to encrypt cookie data using encryption classes in the .NET System.Security.Cryptography namespace. [Read This Article][Top]
Mailing List
Want to receive email when the next article is published? Just Click Here to sign up.