ล่าสุดการพัฒนาเว็บบทเรียน
×

ASP.NET เกี่ยวกับการสอน

ASP.NET บ้าน ASP.NET แนะนำ

WP เกี่ยวกับการสอน

WebPages แนะนำ WebPages มีดโกน WebPages แบบ WebPages โฟลเดอร์ WebPages สถานการณ์โดยรวม WebPages ฟอร์ม WebPages วัตถุ WebPages ไฟล์ WebPages ฐานข้อมูล WebPages ผู้ช่วย WebPages WebGrid WebPages ชาร์ต WebPages อีเมล์ WebPages PHP WebPages ประกาศ WebPages ตัวอย่าง

WP คู่มืออ้างอิง

WebPages ชั้นเรียน WebPages ความปลอดภัย WebPages ฐานข้อมูล WebPages เว็บเมล์ WebPages ผู้ช่วย

ASP.NET Razor

Razor แนะนำ Razor วากยสัมพันธ์ Razor C# ตัวแปร Razor C# ลูป Razor C# ตรรกะ Razor VB ตัวแปร Razor VB ลูป Razor VB ตรรกะ

ASP.NET MVC

MVC แนะนำ MVC ใบสมัคร MVC โฟลเดอร์ MVC แบบ MVC ตัวควบคุม MVC เข้าชม MVC ฐานข้อมูล MVC แบบ MVC ความปลอดภัย MVC HTML ผู้ช่วย MVC ประกาศ MVC การอ้างอิง

WF สอน

WebForms แนะนำ WebForms หน้า WebForms การควบคุม WebForms เหตุการณ์ WebForms ฟอร์ม WebForms ViewState WebForms กล่องข้อความ WebForms ปุ่ม WebForms ข้อมูลผูกพัน WebForms ArrayList WebForms Hashtable WebForms SortedList WebForms XML ไฟล์ WebForms Repeater WebForms DataList WebForms DbConnection WebForms Master หน้า WebForms การเดินเรือ WebForms ตัวอย่าง


 

WebSecurity - ConfirmAccount ()


วัตถุ WebSecurity วัตถุ WebSecurity

คำนิยาม

ConfirmAccount() วิธีการยืนยันและเปิดใช้งานบัญชีผู้ใช้โทเค็นการยืนยัน


C # และ VB ไวยากรณ์

WebSecurity.ConfirmAccount( accountConfirmationToken )

ตัวอย่าง

ตัวอย่างเช่น C #

string message = "";
var confirmationToken = Request["confirmationCode"];

WebSecurity.Logout();

if (!confirmationToken.IsEmpty())
{
    if (WebSecurity.ConfirmAccount(confirmationToken))
    {
    message = "Registration confirmed";
    }
    else
    {
    message = "Could not confirm your registration";
    }
}

ตัวอย่างเช่น VB

message = ""
confirmationToken = Request("confirmationCode")

WebSecurity.Logout()

if !confirmationToken.IsEmpty() then
   if WebSecurity.ConfirmAccount(confirmationToken) then
       message = "Registration Confirmed"
    else
       message = "Could not confirm your registration"
    end if
end if

พารามิเตอร์

พารามิเตอร์ ชนิด ลักษณะ
accountConfirmationToken String tokene ยืนยัน

ราคาย้อนกลับ

ชนิด ลักษณะ
Boolean จริงถ้าบัญชีได้รับการยืนยันเป็นเท็จอย่างอื่น

ข้อผิดพลาดและข้อยกเว้น

การเข้าถึงใด ๆ ไปยังวัตถุ WebSecurity พ่น InvalidOperationException หาก:

  • InitializeDatabaseConnection() วิธีการยังไม่ได้รับการเรียกว่า
  • SimpleMembership ไม่ได้เริ่มต้น (or disabled in the website configuration)

หมายเหตุ

โทเค็นการยืนยันสามารถสร้างขึ้นโดย CreateAccount() , CreateUserAndAccount() หรือ GeneratePasswordResetToken() วิธีการ

ขั้นตอนที่พบบ่อยคือการส่งสัญญาณให้กับผู้ใช้ในอีเมลและขอให้ผู้ใช้เพื่อยืนยันตัวตน (via a link to a confirmation page)


ข้อมูลทางเทคนิค

ชื่อ ความคุ้มค่า
namespace WebMatrix.WebData
การชุมนุม WebMatrix.WebData.dll

<WebSecurity วัตถุ