Latest web development tutorials
×

ASP.NET หลักสูตร

ASP.NET หลักสูตร ASP.NET แนะนำโดยย่อ

WP หลักสูตร

WebPages แนะนำโดยย่อ WebPages Razor WebPages แบบ WebPages โฟลเดอร์ WebPages สถานการณ์โดยรวม WebPages ฟอร์ม WebPages วัตถุ WebPages ไฟล์ WebPages ผู้ช่วย WebPages WebGrid WebPages แผนภูมิ WebPages Email 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 TextBox WebForms Button WebForms ข้อมูลผูกพัน WebForms ArrayList WebForms Hashtable WebForms SortedList WebForms XML ไฟล์ WebForms Repeater WebForms DataList WebForms เชื่อมต่อฐานข้อมูล WebForms หน้าเว็บมาสเตอร์ WebForms การเดินเรือ WebForms ตัวอย่าง

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

WebForms HTML WebForms Controls WebForms Validation

วิธี 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 帐户确认令牌


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

类型 描述
Boolean 如果帐户已确认,则返回 true ,否则返回 false


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

ในสถานการณ์สมมติต่อการเข้าถึงใด ๆ ไปยังวัตถุ WebSecurity จะโยน InvalidOperationException:

  • InitializeDatabaseConnection () วิธีการยังไม่ได้รับการเรียกว่า
  • SimpleMembership ไม่ได้เริ่มต้น (หรือคนพิการในการกำหนดค่าเว็บไซต์)

คำพูด

โทเค็นการยืนยันบัญชีโดย CreateAccount () CreateUserAndAccount () หรือ GeneratePasswordResetToken () วิธีการสร้าง

ขั้นตอนทั่วไปคือการส่งอีเมลไปที่โทเค็นของผู้ใช้ในการตรวจสอบร้องขอของผู้ใช้ (ผ่านการเชื่อมโยงไปยังหน้าการยืนยัน)


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

名称
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


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