从Simple成员资格提供程序切换到ASP.NET成员资格提供程序

时间:2014-04-01 11:59:54

标签: c# asp.net security asp.net-mvc-4

我们有一个用MVC4编写的现有系统,它使用SimpleMembershipProvider。它是使用WebSecurity.InitializeDatabaseConnection()方法初始化的。

我们需要使用单点登录方法将“又一个论坛”整合到我们的系统中。我们设法让它工作但现在我们遇到错误,特别是下面的错误,不支持ApplicationName()方法。

[NotSupportedException: Specified method is not supported.]
   WebMatrix.WebData.SimpleMembershipProvider.get_ApplicationName() +57
   System.Web.Security.Membership.get_ApplicationName() +17
   YAF.Classes.YafBoardSettings..ctor() +190
   YAF.Core.YafLoadBoardSettings..ctor(Int32 boardID) +34
   YAF.Core.CurrentBoardSettings.<get_Instance>b__0() +81
   YAF.Core.HttpApplicationStateBaseExtensions.GetOrSet(HttpApplicationStateBase httpApplicationState, String key, Func`1 getValue) +311
   YAF.Core.CurrentBoardSettings.get_Instance() +122
   YAF.Core.Modules.ServicesModule.<RegisterServices>b__3(IComponentContext k) +81
   Autofac.<>c__DisplayClass10`1.<Register>b__f(IComponentContext c, IEnumerable`1 p) +10
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.Execute() +48
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Specified method is not supported. (See inner exception for details.)]
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +109
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType) +68
   YAF.Core.AutoFacServiceLocatorProvider.Get(Type serviceType) +81
   YAF.Types.Interfaces.IServiceLocatorExtensions.Get(IServiceLocator serviceLocator) +142
   YAF.Types.Interfaces.IServiceLocatorExtensions.Get(IHaveServiceLocator haveLocator) +131
   YAF.Core.YafContext.get_BoardSettings() +46
   YAF.Core.UnloadSessionForumModule.UnloadSessionModule_Unload(Object sender, EventArgs e) +120
   System.Web.UI.Control.OnUnload(EventArgs e) +9583810
   YAF.Forum.OnUnload(EventArgs e) +7
   System.Web.UI.Control.UnloadRecursive(Boolean dispose) +227
   System.Web.UI.Control.UnloadRecursive(Boolean dispose) +163
   System.Web.UI.Control.UnloadRecursive(Boolean dispose) +163
   System.Web.UI.Page.UnloadRecursive(Boolean dispose) +23
   System.Web.UI.Page.ProcessRequestCleanup() +56
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
   System.Web.UI.Page.ProcessRequest() +72
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +58
   ASP.yaf_default_aspx.ProcessRequest(HttpContext context) +4
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

根据Microsoft的文档http://msdn.microsoft.com/en-us/library/webmatrix.webdata.simplemembershipprovider.applicationname(v=vs.111).aspx,如果您使用此方法,则ApplicationName属性不可用。

是否可以在“其他”模式下使用SimpleMembershipProvider,或者迁移到ASP.NET成员资格提供程序,但仍保留系统中的现有用户?

0 个答案:

没有答案