Skip to content
 

DPAPI Decrypt Request Failed exception

For the last couple of days, I’ve been dealing with a web hosting service “mistake”. they decided to limit the usage of trust level attribute, at the web.config file.

so suddenly, the code couldn’ t decrypt the connection string and a nice exception flashed into my eyes:

“System.Security.SecurityException : Request Failed”

at the web.config i used <trust level=”Full” originUrl=”/”> to grant full access to the code, and for opening the configuration:

Configuration cfg = WebConfigurationManager.OpenWebConfiguration(“/”);

ConnectionStringsSectionsection = cfg.ConnectionStrings;

 

the Exception popped from the first line. so how you get your configuration from a lower trust level ?!

instead using OpenWebConfiguration and getting the ConnectionStrings property, you can write the following line:

 

 ConnectionStringsSection section = (ConnectionStringsSection)WebConfigurationManager.GetSection(“connectionStrings”); 

finally, i works great under Medium trust level!!

Isaac.

2 Comments

  1. Eldan says:

    Hello Isaac,

    I am new to MVC and Entity Frameworks.
    How do I manage users and accounts in ASP.NET, MVC Framework?
    Is there a build in functionallity on MVC?

    Thanks

Leave a Reply