
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Obtaining the Full Reason a SecurityException Was Thrown
|
1007
The DecryptWebConfigData method operates very similarly to the EncryptWebConfigData
method, except that it calls the UnprotectSection method to decrypt the encrypted
data in the web.config file:
webConfigSection.SectionInformation.UnprotectSection( );
If you encrypt data in the web.config file using this technique, the data will automati-
cally be decrypted when the web application accesses the encrypted data in the web.
config file.
See Also
See the “System.Configuration.Configuration Class” topic in the MSDN documenta-
tion.
17.18 Obtaining the Full Reason a SecurityException
Was Thrown
Problem
You need more information as to why a SecurityException was thrown.
Solution
Use the new properties available on the SecurityException object, shown in
Table 17-2.
Table 17-2. SecurityException Properties
Property Description
Action This property returns a SecurityAction enumeration value indicating the cause of the secu-
rity check failure. Possible values can be any of the following:
Assert
Demand
DemandChoice
Deny
InheritanceDemand
InheritanceDemandChoice
LinkDemand
LinkDemandChoice
PermitOnly
RequestMinimum
RequestOptional
RequestRefuseusing
Data
An IDictionary of user-defined key-value pairs.