-\r
-using System.CodeDom.Compiler;\r
-\r
-namespace System.Web {\r
- public sealed class HttpCompileException : HttpException {\r
-\r
- #region Fields\r
-\r
- CompilerResults results;\r
- string sourceCode;\r
-\r
- #endregion // Fields\r
-\r
- #region Constructors\r
-\r
- internal HttpCompileException (CompilerResults results, string sourceCode)\r
- : base ()\r
- {\r
- this.results = results;\r
- this.sourceCode = sourceCode;\r
- }\r
-\r
- #endregion // Constructors\r
-\r
- #region Properties\r
-\r
- public CompilerResults Results {\r
- get { return results; }\r
- }\r
-\r
- public string SourceCode {\r
- get { return sourceCode; }\r
- }\r
-\r
- #endregion // Properties\r
- }\r
-}\r
+
+using System.CodeDom.Compiler;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+
+namespace System.Web
+{
+ // CAS - no InheritanceDemand here as the class is sealed
+ [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [Serializable]
+ public sealed class HttpCompileException : HttpException
+ {
+ CompilerResults results;
+ string sourceCode;
+
+ public HttpCompileException ()
+ {
+ }
+
+ public HttpCompileException (string message)
+ : base (message)
+ {
+ }
+
+ public HttpCompileException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ public HttpCompileException (CompilerResults results, string sourceCode)
+ {
+ this.results = results;
+ this.sourceCode = sourceCode;
+ }
+
+
+ public CompilerResults Results {
+ [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
+ get { return results; }
+ }
+
+ public string SourceCode {
+ [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
+ get { return sourceCode; }
+ }
+
+ public override string Message {
+ get { return base.Message; }
+ }
+
+ [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ sourceCode = info.GetString ("sourcecode");
+ results = (CompilerResults) info.GetValue ("results", typeof (CompilerResults));
+ }
+ }
+}