Custom Membership Provider

D

David Bowen

Hi,

I have written a custom membership provider based to access an existing SQL
profile store. However when I upload my application to a shared hosting
environment I get a security exception of the type IO Exception. This boils
down to a number of lines of code in my provider trying to access the
system.web/machine keys section of my web.config.

The lines of code are:
Configuration cfg =
WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
machineKey = (MachineKeySection) cfg.GetSection("system.web/machineKey");

And I have tried this instead to no avail:
machineKey =
(MachineKeySection)WebConfigurationManager.GetWebApplicationSection("system.web/machineKey");


Please can someone assist so that I use my custom provider in a shared
hosting environment.

Thanks,

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top