This project is read-only.

Reading machine key from configSource


My web.config has the following (legit) tag:
<machineKey configSource="App_Data\config\machineKey.config" />
Shinkansen fails with run-time error b/c it can't find the machine key to be in web.config (looked in your code and you are XML-parsing web.config).
This should be supported.


MilanNegovan wrote Feb 23, 2010 at 3:12 AM

You're right, it's a perfectly legit tag. Unfortunately, the code will have to rely on the configuration API, which requires full trust.

I've created a sample provider, FullTrustMachineKeyProvider, which works with this scenario as intended. You will find an example of how to wire it in global.asax.cs.

postmoderncore wrote Mar 28, 2011 at 2:30 AM

FullTrustMachineKeyProvider looks good, but why not combine this into the default provider? So it attempts to retrieve via full trust and the XML parsing solution is a fall back for partial trust environments. I would have thought there must be quite a few people using non-parseable machine key configurations. In my case, we set the machineKey on a per computer level, rather than per application.

wrote Feb 13, 2013 at 11:32 PM