English 中文(简体)
与习俗角色有关的问题
原标题:Problem with custom Role Provider

This stack trace comes as a result of an error that reads "Provider name cannot be null or empty. "

[ArgumentException: Provider name cannot be null or empty.] System.Web.Security.Roles.Initialize() +2230205 System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs) +68 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Essentially I am creating my own custom role provider that inherits the SqlRoleProvider class, i m calling initialize successfully and have confirmed that it sucessfully does everything in my code but something in .Net is clearly not being initialized right as the "Roles" object that I can t inherit is causing me some headaches ...

是否有任何想法?

• 我的解决办法是分层的,这意味着我需要通过商业目标层提供安全保障......这样我就界定如下:

------

我的法典:

主要会议:

public class C20RoleProvider : RoleProvider
{
     private C20SqlRoleDataProvider prov;

     C20RoleProvider()
     {
         // this code is actually using some reflection based on config files
         // i have simplified this to illustrate the problem im having ...
         prov = new C20SqlRoleDataProvider();
     }

     public override void Initialize(string name, NameValueCollection config)
     {
         prov.Initialize(name, config);
     }
}

在供应商大会上:

public class C20SqlRoleDataProvider : SqlRoleProvider
{
      // code omitted
}

现在,我期望能够利用“供应商”这一基类通过发出呼吁来界定的任何东西。 ......

我删除了该外法,但基本上所有从“C20RoleProvider”类“角色提供人”类别中标明的抽象方法。

我知道,它看上去是比喻的,但什么看上去做是将业务逻辑与供应商的数据分开的,数据提供者是任何东西(通过我的思考法),在商业框架中可以使用“C20RoleProvider”这一商业逻辑类别,而不必担心会破坏任何东西,并允许替换后端来源(例如,作用数据可以来自任何地方)。

这里的情况更多,但基本上整个应用框架/商业目标层以这种方式利用供应商从任何来源向核心业务逻辑提供“提供”数据。

最佳回答

Ok i做了一些挖掘......转而指出,“Name”财产实际上没有在任何地方提及......。

解决办法类似......。

public class C20RoleProvider : RoleProvider 
{ 
     private C20SqlRoleDataProvider prov; 

     public string Name
     {
         get {return prov.Name;}
     }

     C20RoleProvider() 
     { 
         // this code is actually using some reflection based on config files 
         // i have simplified this to illustrate the problem im having ... 
         prov = new C20SqlRoleDataProvider(); 
     } 

     public override void Initialize(string name, NameValueCollection config) 
     { 
         prov.Initialize(name, config); 
     } 
} 

更糟糕的是,这个数字似乎在网上任何地方都知道。

问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签