ASP.NET MVC – 安全簡介
MVC 應用程式安全
Models 資料夾包含表示應用程式模型的類。
Visual Web Developer 自動建立 AccountModels.cs 檔案,該檔案包含用於應用程式認證的模型。
AccountModels 包含 LogOnModel、ChangePasswordModel 和 RegisterModel:
Change Password 模型
public class ChangePasswordModel { [Required] [DataType(DataType.Password)] [Display(Name = "Current password")] public string OldPassword { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "New password")] public string NewPassword { get; set; } [DataType(DataType.Password)] [Display(Name = "Confirm new password")] [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] public string ConfirmPassword { get; set; } }
Logon 模型
public class LogOnModel { [Required] [Display(Name = "User name")] public string UserName { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } }
Register 模型
public class RegisterModel { [Required] [Display(Name = "User name")] public string UserName { get; set; } [Required] [DataType(DataType.EmailAddress)] [Display(Name = "Email address")] public string Email { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [DataType(DataType.Password)] [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69901823/viewspace-2857735/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ASP.NET MVC – 模型簡介ASP.NETMVC模型
- ASP.NET MVC – 檢視簡介ASP.NETMVC
- ASP.NET MVC – 控制器簡介ASP.NETMVC
- ASP.NET MVC – SQL 資料庫簡介ASP.NETMVCSQL資料庫
- ASP.NET MVC4 入門簡介ASP.NETMVC
- ASP.NET MVC – 樣式和佈局簡介ASP.NETMVC
- ASP.NET MVC 介紹ASP.NETMVC
- 筆記:ASP.NET MVC安全筆記ASP.NETMVC
- MVC開發簡介MVC
- Spring MVC 通俗簡介SpringMVC
- ASP.NET MVC中簡單使用AutofacASP.NETMVC
- ASP.NET 5 簡介ASP.NET
- 第一章 Web MVC簡介WebMVC
- ASP.NET Razor – 標記簡介ASP.NET
- ASP.NET Web Pages – 物件簡介ASP.NETWeb物件
- ASP.NET Web Forms – 事件簡介ASP.NETWebORM事件
- ASP.NET Session簡單介紹ASP.NETSession
- ASP.NET Core 5.0 MVC中的 Razor 頁面 介紹ASP.NETMVC
- ASP.NET MVC路由ASP.NETMVC路由
- ASP.NET MVC ModuleASP.NETMVC
- ASP.NET MVC TemplateASP.NETMVC
- ASP.NET MVC ErrorASP.NETMVCError
- ASP.NET MVC FilterASP.NETMVCFilter
- UpdatePanel for ASP.NET MVCASP.NETMVC
- ASP.NET Web Forms – SortedList 物件簡介ASP.NETWebORM物件
- ASP.NET Web Forms – Hashtable 物件簡介ASP.NETWebORM物件
- ASP.NET Web Forms – ArrayList 物件簡介ASP.NETWebORM物件
- ASP.NET Web Forms – 導航簡介ASP.NETWebORM
- ASP.NET MVC與ASP.NET WebFormASP.NETMVCWebORM
- 【第三篇】ASP.NET MVC快速入門之安全策略(MVC5+EF6)ASP.NETMVC
- 跟開濤學Spring MVC:第一章 Web MVC簡介SpringMVCWeb
- [ASP.NET MVC 小牛之路]01 - 理解MVC模式ASP.NETMVC模式
- 【J2EE】:MVC模式的簡介與分析MVC模式
- ASP.NET MVC 學習心得 (1) - 怎樣建立簡單程式ASP.NETMVC
- Asp.Net MVC HttpPost用法ASP.NETMVCHTTP
- ASP.NET MVC 反射例子ASP.NETMVC反射
- Asp.Net MVC 快取ASP.NETMVC快取
- Asp.Net MVC 使用 AjaxASP.NETMVC