Feature #17

PostgreSQLProvider in non-web hosted applications

Added by Anonymous over 2 years ago. Updated about 2 years ago.

Status:Closed Start:01/19/2010
Priority:Normal Due date:01/19/2010
Assigned to:Daniel Nauck % Done:

100%

Category:Membership Spent time: 1.00 hour
Target version:2.0 Estimated time:1.00 hour

Description

I am writing a WCF service that is not hosted in IIS. In PgMembershipProvider Initialize(....) HostingEnvironment.!ApplicationVirtualPath will always be null.
Because of this WebConfigurationManager.!OpenWebConfiguration(...) will always return the machine config instead of the application config, thus never reading the
machine key settings correctly from the application's configuration.

This can be fixed by checking to see if an ApplicationVirtualPath is present or not, and then opening the application's .exe configuration.

Suggested change PgMembershipProvider.cs line 107:

            Configuration cfg = null;
            if (HostingEnvironment.ApplicationVirtualPath != null)
            {
                cfg = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath);
            }
            else
            {
                // hosted in an application
                cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            }
            m_machineKeyConfig = (MachineKeySection)cfg.GetSection("system.web/machineKey");

Thanks!
Dan

Associated revisions

Revision d585bf824ea375d1676168a8d84f1cf7df2577a8
Added by Daniel Nauck about 2 years ago

Issue #17: Implement support for non web hosted applications

  • check whether the current HttpContext is null. If its null we are non web hosted and then we use the applications config file. fixes #17

History

Updated by Daniel Nauck over 2 years ago

  • Status changed from New to Assigned

Updated by Daniel Nauck about 2 years ago

  • Priority changed from High to Normal
  • Start set to 01/19/2010
  • % Done changed from 0 to 10
  • Estimated time set to 1.00

Updated by Daniel Nauck about 2 years ago

  • Due date set to 01/19/2010
  • % Done changed from 10 to 100

Updated by Daniel Nauck about 2 years ago

  • Status changed from Assigned to Closed

Status geƤndert durch Changeset d585bf824ea375d1676168a8d84f1cf7df2577a8.

Also available in: Atom PDF