CreateUserWizard.Question CreateUserWizard.Question CreateUserWizard.Question CreateUserWizard.Question Property

定義

ユーザーが入力したパスワード復元のための確認の質問を取得または設定します。Gets or sets the password recovery confirmation question entered by the user.

public:
 virtual property System::String ^ Question { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
public virtual string Question { get; set; }
member this.Question : string with get, set
Public Overridable Property Question As String

プロパティ値

ユーザーが入力したパスワード復元のための確認の質問。The password recovery confirmation question entered by the user. 既定値は、空の文字列 ("") です。The default value is an empty string ("").

次のコード例では、 SendingMailイベントの電子メールメッセージを変更し、新しいユーザーに送信されるメッセージにユーザーのパスワードの回復確認の質問を含めます。The following code example modifies the email message in the SendingMail event to include the user's password recovery confirmation question in the message sent to new users.

<%@ Page Language="C#"%>
<%@ Import namespace="Samples.AspNet.CS.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void Page_Load(object sender, EventArgs e) {    
    Placeholder1.Controls.Add(new CustomCreateUserWizard());
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>CreateUserWizard.OnSendingMail sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:placeholder id="Placeholder1" runat="server" >
      </asp:placeholder>
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB"%>
<%@ Import namespace="Samples.AspNet.VB.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim createUser As New CustomCreateUserWizard
    Placeholder1.Controls.Add(createUser)
  End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard.OnSendingMail sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:placeholder id="Placeholder1" runat="server" >
      </asp:placeholder>
    </div>
    </form>
</body>
</html>
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls {

[AspNetHostingPermission (System.Security.Permissions.SecurityAction.Demand,
  Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (System.Security.Permissions.SecurityAction.InheritanceDemand,
  Level = AspNetHostingPermissionLevel.Minimal)]
  public class CustomCreateUserWizard : CreateUserWizard
  {
    public CustomCreateUserWizard()
    {
      this.MailDefinition.BodyFileName = "MailFile.txt";
      this.MailDefinition.From = "userAdmin@your.site.name.here";
    }
  
    protected override void OnSendingMail(MailMessageEventArgs e) 
    {
      e.Message.Subject = "New Web site user.";
    
      // Replace placeholder text in message body with information
      //  provided by the user.
      e.Message.Body.Replace("<%PasswordQuestion%>",this.Question);
      e.Message.Body.Replace("<%PasswordAnswer%>", this.Answer);
    
      base.OnSendingMail(e);
    }
  }
}
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
  <AspNetHostingPermission(System.Security.Permissions.SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class CustomCreateUserWizard
    Inherits CreateUserWizard
    
    Public Sub New()
      Me.MailDefinition.BodyFileName = "MailFile.txt"
      Me.MailDefinition.From = "userAdmin@your.site.name.here"
    End Sub
    
    Protected Overloads Sub OnSendingMail(ByVal e As MailMessageEventArgs)
      e.Message.Subject = "New user on Web site."
      ' Replace placeholder text in message body with information
      '  provided by the user.
      e.Message.Body.Replace("<%PasswordQuestion%>", Me.Question)
      e.Message.Body.Replace("<%PasswordAnswer%>", Me.Answer)
      
      MyBase.OnSendingMail(e)
    End Sub
  End Class
End Namespace

注釈

MembershipProviderプロパティで指定されたメンバーシッププロバイダーによってQuestionAnswerおよびテキストボックスが実行時に表示されるかどうかが決まります。The membership provider specified in the MembershipProvider property will determine whether the Question and Answer text boxes are displayed at run time. CreateUserWizardコントロールに表示される各テキストボックスにRequiredFieldValidatorは、が関連付けられています。Each text box displayed on the CreateUserWizard control has a RequiredFieldValidator associated with it.

このプロパティは、テーマまたはスタイル シート テーマによって設定することはできません。This property cannot be set by themes or style sheet themes. 詳細についてはThemeableAttribute 、「」および「 ASP.NET theme and スキン」を参照してください。For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

このプロパティの値は、設定されると、デザイナーツールを使用してリソースファイルに自動的に保存できます。The value of this property, when set, can be saved automatically to a resource file by using a designer tool. 詳細についてはLocalizableAttribute 、「」および「グローバリゼーションとローカリゼーション」を参照してください。For more information, see LocalizableAttribute and Globalization and Localization.

適用対象

こちらもご覧ください