Corrected code below:
> void Application_OnError()
> {
> Exception error = Server.GetLastError();
> error = error.InnerException;
> string errors;
> if (error is System.Web.HttpCompileException)
> {
> foreach (System.CodeDom.Compiler.CompilerError err in
> ((System.Web.HttpCompileException) error).Results.Errors)
> {
> errors += err.ToString() + "\n";
> }
What you were doing before made no sense to the compiler - you were
trying to iterate over a class, not an object. What you really wanted
was the Errors collection that you get from the Results property of the
HttpCompileException object.
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.