App_Code/Providers/CustomRoleProvider.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================
using System;
using System.IO;
using System.Configuration.Provider;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Xml.Serialization;
namespace MyWebPagesStarterKit.Providers
{
/// <summary>
/// Specialized RoleProvider that uses a file (Roles.config) to store its data.
/// </summary>
public class CustomRoleProvider : RoleProvider
{
private String rolesfile;
private const string _cProviderName = "CustomRoleProvider";
private const string _cRolesFilename = "Roles.config";
private string _applicationName;
private List<RoleData> _roles;
public CustomRoleProvider()
{
rolesfile = HttpContext.Current.Server.MapPath(string.Format("~/App_Data/{0}", _cRolesFilename));
}
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
if (!WebSite.GetInstance().ReadyToUse)
throw new WebsiteNotReadyException("This website is not yet ready to use. Please verify that all required file/folders exist.");
if (config == null)
throw new ArgumentNullException("config");
name = _cProviderName;
if (String.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description", "Xml membership provider");
}
// Initialize the abstract base class.
base.Initialize(name, config);
_applicationName = getConfigValue(config["applicationName"], System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
//load/create the rolesfile
if (File.Exists(rolesfile))
后面还有 234 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
