简体   繁体   中英

How do I properly set up forms authentication in EWL?

I want to use forms authentication for an entire web site in EWL. It's just not working.

  • I have created a UserManagementProvider which extends FormsAuthCapableUserManagementProvider.
  • I have set the root Entity Setup to force there to be an authenticated user (protected override bool UserCanAccessEntitySetup { get { return AppTools.User != null; } })
  • I have the following implemention of GetShortcutUrlResolvers in Global.asax:

     protected override IEnumerable<ShortcutUrlResolver> GetShortcutUrlResolvers() { yield return new ShortcutUrlResolver( "", ConnectionSecurity.SecureIfPossible, () => AppTools.User == null ? null : Pages.Dashboard.GetInfo() ); } 

I get an Access Denied exception when visiting the root of the site. If I remove the AppTools.User == null ? null ternary, I get an unhandled exception saying that GetUrl was called for a user that didn't have permission. If I add the shortcut URL only if there is an authenticated user, I get a "This page is no longer available" error because it doesn't know where to send me when I go to the root URL. I am never presented with the login page. What else do I have to do?

Maybe EWL is not picking up your provider. Make sure the class is called UserManagement (not UserManagementProvider) and is in the YourLibraryProjectNamespace.Configuration.Providers namespace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM