⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 siteidentity.cs

📁 基于角色的用户验证. 这个程序重点写了四个pages以实现这些功能:增加用户
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;

namespace RolesBasedAthentication
{
	public class SiteIdentity: System.Security.Principal.IIdentity
	{
		private int userID;
		private string fullName;
		private string email;
		private string password;
		
		public SiteIdentity( string email )
		{
			User user = new User(email);

			this.userID = user.UserID;
			this.fullName = user.FullName;
			this.email = user.Email;
			this.password = user.Password;
		}

		public SiteIdentity( int userID )
		{
			User user = new User(userID);

			this.userID = user.UserID;
			this.fullName = user.FullName;
			this.email = user.Email;
			this.password = user.Password;
		}

		// Properties
		public string AuthenticationType
		{
			get { return "Custom Authentication"; }
		}

		public bool IsAuthenticated
		{
			get 
			{
				// assumption: all instances of a SiteIdentity have already
				// been authenticated.
				return true;
			}
		}

		public int UserID
		{
			get { return userID; }
		}

		public string Name
		{
			get { return fullName; }
		}

		public string Email
		{
			get { return email; }
		}				

		public string Password
		{
			get { return password; }
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -