ASP.NET MVC - సురక్షితత్వం
- ముందు పేజీ ఎంవిసి మోడల్
- తరువాత పేజీ ఎంవిసి హెచ్టిఎంఎల్ హెల్పర్
ASP.NET MVC నేర్చుకోవడానికి, మేము ఇంటర్నెట్ అప్లికేషన్ నిర్మించాలి.
భాగం 8:సురక్షితత్వం జోడించండి.
MVC అప్లికేషన్ సురక్షితత్వం
మోడల్స్ ఫోల్డర్అప్లికేషన్ మోడల్స్ను ప్రతినిధీకరించే క్లాస్లను కలిగిస్తుంది.
Visual Web Developer ఆటోమేటిక్గా సృష్టించబడింది AccountModels.cs ఫైల్, దానిలో అప్లికేషన్ గుర్తింపుకు ఉపయోగపడే మోడల్స్ ఉన్నాయి.
AccountModels కలిగిస్తుంది LogOnModel、ChangePasswordModel మరియు RegisterModel:
పాస్వర్డ్ మాడల్
public class ChangePasswordModel { [Required] [DataType(DataType.Password)] [Display(Name = "ప్రస్తుత పాస్వర్డ్")] 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 = "కొత్త పాస్వర్డ్")] public string NewPassword { get; set; } [DataType(DataType.Password)] [Display(Name = "కొత్త పాస్వర్డ్ నిర్ధారణ")] [Compare("NewPassword", ErrorMessage = "కొత్త పాస్వర్డ్ మరియు నిర్ధారణ పాస్వర్డ్ అనుకూలించలేదు")] 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; } }
- ముందు పేజీ ఎంవిసి మోడల్
- తరువాత పేజీ ఎంవిసి హెచ్టిఎంఎల్ హెల్పర్