Custom Membership Provider

Discussion in 'ASP .Net Security' started by David Bowen, Aug 8, 2006.

  1. David Bowen

    David Bowen Guest

    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
    David Bowen, Aug 8, 2006
    #1
    1. Advertising

  2. what the exact exception?

    ---
    Dominick Baier, DevelopMentor
    http://www.leastprivilege.com

    > 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.Hostin
    > gEnvironment.ApplicationVirtualPath);
    > machineKey = (MachineKeySection)
    > cfg.GetSection("system.web/machineKey");
    > And I have tried this instead to no avail:
    > machineKey =
    > (MachineKeySection)WebConfigurationManager.GetWebApplicationSection("s
    > ystem.web/machineKey");
    > Please can someone assist so that I use my custom provider in a shared
    > hosting environment.
    >
    > Thanks,
    >
    > David
    >
    Dominick Baier, Aug 20, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    3
    Views:
    4,362
    stribbed
    Jun 21, 2007
  2. sloan
    Replies:
    5
    Views:
    1,496
    sloan
    Jun 4, 2006
  3. Replies:
    0
    Views:
    723
  4. sloan
    Replies:
    1
    Views:
    496
    Chad Scharf
    Jul 3, 2007
  5. Brett Ossman

    Custom Membership Provider - Custom Error Messages

    Brett Ossman, Mar 11, 2009, in forum: ASP .Net Security
    Replies:
    0
    Views:
    778
    Brett Ossman
    Mar 11, 2009
Loading...

Share This Page