PostgreSQLProvider in non-web hosted applications (Feature #17)


Added by Anonymous almost 4 years ago. Updated over 3 years ago.


Status:Closed Start date:01/19/2010
Priority:Normal Due date:01/19/2010
Assignee: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 d585bf82
Added by Daniel Nauck over 3 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 3 years ago

  • Status changed from New to Assigned

Updated by Daniel Nauck over 3 years ago

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

Updated by Daniel Nauck over 3 years ago

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

Updated by Daniel Nauck over 3 years ago

Status geƤndert durch Changeset d585bf824ea375d1676168a8d84f1cf7df2577a8.

  • Status changed from Assigned to Closed

Also available in: Atom PDF