Adding Security to an Existing Website
The procedure earlier in this article relies on using the Starter Site template as the basis for website security. If it isn't practical for you to start from the Starter Site template or to copy the relevant pages from a site based on that template, you can implement the same type of security in your own site by coding it yourself. You create the same types of pages — registration, login, and so on — and then use helpers and classes to set up membership.
The basic process is described in the blog post THE most basic way to implement ASP.NET Razor security. Most of the work is done using the following methods and properties of the WebSecurity
helper:
WebSecurty.UserExists, WebSecurity.CreateUserAndAccount. These methods let you determine whether someone is already registered and to register them.
WebSecurty.IsAuthenticated. This property lets you determine whether the current user is logged in. This is useful to redirect users to a login page if they have not already logged in.
WebSecurity.Login, WebSecurity.Logout. These methods log a user in or out.
WebSecurity.CurrentUserName. This property is useful for displaying the current user's logged-in name (if the user is logged in).
WebSecurity.ConfirmAccount. This method is useful if you set up email confirmation for registration. (Details are described in the blog post Using the confirmation feature for ASP.NET Web Pages security.)
To manage roles, you can use the Roles and Membership classes, as described in the blog entry.
Adding Security to an Existing Website的更多相关文章
- Migrating an Existing Website from SQL Membership to ASP.NET Identity
Migrating an Existing Website from SQL Membership to ASP.NET Identity public class User : IdentityUs ...
- 【跟着stackoverflow学Pandas】 - Adding new column to existing DataFrame in Python pandas - Pandas 添加列
最近做一个系列博客,跟着stackoverflow学Pandas. 以 pandas作为关键词,在stackoverflow中进行搜索,随后安照 votes 数目进行排序: https://stack ...
- Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects
Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects Gradle is very flexible. ...
- sharepoint adfs Adding Claims to an Existing Token Issuer in SharePoint 2010
转载链接 http://www.theidentityguy.com/articles/2010/10/19/adding-claims-to-an-existing-token-issuer-i ...
- Big Data Analytics for Security(Big Data Analytics for Security Intelligence)
http://www.infoq.com/articles/bigdata-analytics-for-security This article first appeared in the IEEE ...
- PhD Positions opening at University of Nevada, Reno (Wireless Networking / Cognitive Radio / Wireless Security)
PhD Positions opening at University of Nevada, RenoDept. of Computer Science and Engineering Researc ...
- Spring Security(二十二):6.4 Method Security
From version 2.0 onwards Spring Security has improved support substantially for adding security to y ...
- Spring Security(十七):5.8 Method Security
From version 2.0 onwards Spring Security has improved support substantially for adding security to y ...
- Spring Security(十二):5. Java Configuration
General support for Java Configuration was added to Spring Framework in Spring 3.1. Since Spring Sec ...
随机推荐
- 用python写自定义模板
模板语法有点像php !/usr/bin/env python """ #demo.py.html <html> <?py include head.p ...
- CodeForces 610B-Vika and Squares,有坑点,不是很难~~
B. Vika and Squares time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- iOS第三方地图-百度地图中心点定位
使用百度地图定位后,滑动地图,使用反编码确定地图中心店的位置信息 // // MapControl.m // quyizu // // Created by apple on 15/9/2. // C ...
- 【二分+尺取】HDU 6119 小小粉丝度度熊
http://acm.hdu.edu.cn/showproblem.php?pid=6119 [思路] 首先通过处理交叉的可以处理成不交叉的 然后二分查找答案 如何判断一个长度是否可行? 双指针O(n ...
- 使用Windows系统远程连接Windows server服务器
点击开始菜单->运行 (或者 windows+R) ,输入"mstsc"命令, 打开远程桌面连接对话框,输入你要连接的Windows server服务器的公网IP. 点击 ...
- 全局Session-GlobalSession
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.spri ...
- 【Ural1297】Palindrome(后缀数组)
题意:求一个字符串的最长回文子串 n<=1000 思路:这是一道论文题 需要注意的细节: 1.奇偶分类 2.中间的分割符与最后的附加字母都是最小值,但两者不能相同,否则height可能会出现问题 ...
- msp430项目编程10
msp430中项目---电子密码锁 1.扫描键盘工作原理 2.电路原理说明 3.代码(显示部分) 4.代码(功能实现) 5.项目总结 msp430项目编程 msp430入门学习
- express 写接口
实例下载:百度云盘免密码 (): 指注释 一.准备工作 1.安装express npm install express -g npm install express-generator -g 2.初始 ...
- spring mvc技术
spring mvc之访问路径 1. @RequestMapping这个注解 在实际项 ...