Online Resources for Web Developers and Professionals - BETA

  search

Exam : MCPD - NET Framework 2.0-Web-based Client Development.

Automatically send email using CreateUserWizard ASP.NET Control

The CreateUserWizard control provides the user interface for the MembershipProvider object that communicates with your Web site's user data store to create new user accounts in the data store. The CreateUserWizard relies on the MembershipProvider to create the user and disable them if necessary.

By default, the CreateUserWizard control will accept a user name and password from the Web site visitor. Based on the requirements of the site's MembershipProvider object, the CreateUserWizard control will optionally accept an e-mail address, represented by the Email property, and a password recovery confirmation question and answer, represented by Question and Answer. For a table showing all required and optional controls for CreateUserWizard, see CreateUserStep.

Example:

 

 

<%@ page language="VB"%>
<script runat="server">
</script>
<html>
<head runat="server">
<title>CreateUserWizard basic sample</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:createuserwizard id="Createuserwizard1" runat="server">
</asp:createuserwizard>
</div>
</form>
</body>
</html>

 

 

Exam related Question.

 

 

You create a Web Form that allows users to create a new account. You add a
CreateUserWizard control by using the following code segment.
<asp:CreateUserWizard id="Wizard1" runat="server"/>
You need to ensure that the wizard automatically sends an e-mail message to users when
they finish creating their accounts. You add a valid <smtp> element to the Web.config
file. Which code segment should you add to the PageLoad event?

A. Wizard1.RequireEmail = True
B. Wizard1.Email = "user@address.com"
C. Wizard1.MailDefinition.From = "registration@mysite.com"
D. SmtpMail.SmtpServer = "mail.contoso.com"

Answer: C

Explanation:


Explanation: Correct 
Answer: C Setting the MailDefinition.From property of the
wizard will enable the automatic sending of emails.
A RequireEmail property to True will have no affect because this is the default value
anyway. The wizard will throw an exception if the RequireEmail property is true and an
email for the user is not given.
B will set the email address of the user to user@address.com. Clearly this is incorrect
because the intention is to email the specific user that has been created.
D The question states that details of the SMTP server have already been provided in the
web.config file.

References:


No reference found
Prev 1  2  3  4  5  6  7  8  9  10  11  Next

Exam related books