I've Googled this for a while, to no avail. Hopefully someone can help me.
Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax
error. For example, broken.aspx might only contain the following line of code:
<% Dim x as %>
When I visit this page from my Web browser, I see all the helpful ASP.NET
Server Error information, including:
Compilation Error
Compiler Error Message: BC30182: Type expected.
Source Error: Line 1: <% Dim x as %>
Source File: c:\inetpub\mysi te\broken.aspx
This is great information; exactly what I need to troubleshoot the problem!
However on my site, I trap the Exception in my Global.asax.vb' s
Application_Err or handler so that I'm notified when an error occurs. Usually
I'm able to cull useful information from the Exception, but in the event of a
Compilation Error, here's all I can see:
System.Web.Http Exception: External component has thrown an exception.
---> System.Web.Http CompileExceptio n: External component has thrown an
exception.
at
System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults
results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String
sourceFile, String sourceString)
at System.Web.Comp ilation.BaseCom piler.GetCompil edType()
at System.Web.UI.P ageParser.Compi leIntoType()
at System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation()
--- End of inner exception stack trace ---
at System.Web.UI.T emplateParser.G etParserCacheIt emInternal(Bool ean
fCreateIfNotFou nd)
at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path()
at System.Web.UI.T emplateParser.G etParserCacheIt em()
at
System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing
virtualPath, String inputFile, HttpContext context)
at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context,
String requestType, String url, String path)
at System.Web.Http Application.Map HttpHandler(Htt pContext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
at
System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously)
The above is the result of "Server.GetLast Error().ToStrin g()" in my
Application_Err or code.
So now I'm wondering, how can I *programmatical ly* learn the same
information shown in the first example output, when Application_Err or event
handler executes?
I'm using the .NET Framework 1.1 SP 1.
Thanks for your help! 6 2904
"Plat" <Pl**@discussio ns.microsoft.co m> wrote in message
news:C7******** *************** ***********@mic rosoft.com... I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax error. For example, broken.aspx might only contain the following line of code:
<% Dim x as %>
At the risk of being unhelpful...
Inline server-side script is allowed for backwards-compatability with asp,
but it should be avoided. This is just one of the many problems you will
have using inline VB in aspx.
Move all of your server-side code to code-behind classes and you will catch
compile errors at compile-time, where they belong. As well as better type
safety, easier debugging, intellisense, etc.
David
If you cast the Exception to an HttpCompileExce ption (assuming the cast is
possible <g>), it should be possible to read the error details (including
line numbers) from the Errors collection of the CompilerResults object
exposed via the exception's Results property.
HTH,
Nicole
"Plat" <Pl**@discussio ns.microsoft.co m> wrote in message
news:C7******** *************** ***********@mic rosoft.com... I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax error. For example, broken.aspx might only contain the following line of code:
<% Dim x as %>
When I visit this page from my Web browser, I see all the helpful ASP.NET Server Error information, including:
Compilation Error Compiler Error Message: BC30182: Type expected. Source Error: Line 1: <% Dim x as %> Source File: c:\inetpub\mysi te\broken.aspx
This is great information; exactly what I need to troubleshoot the problem! However on my site, I trap the Exception in my Global.asax.vb' s Application_Err or handler so that I'm notified when an error occurs. Usually I'm able to cull useful information from the Exception, but in the event of a Compilation Error, here's all I can see:
System.Web.Http Exception: External component has thrown an exception. ---> System.Web.Http CompileExceptio n: External component has thrown an exception. at System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Comp ilation.BaseCom piler.GetCompil edType() at System.Web.UI.P ageParser.Compi leIntoType() at System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation() --- End of inner exception stack trace --- at System.Web.UI.T emplateParser.G etParserCacheIt emInternal(Bool ean fCreateIfNotFou nd) at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path() at System.Web.UI.T emplateParser.G etParserCacheIt em() at System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context, String requestType, String url, String path) at System.Web.Http Application.Map HttpHandler(Htt pContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) at System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute() at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean& completedSynchr onously)
The above is the result of "Server.GetLast Error().ToStrin g()" in my Application_Err or code.
So now I'm wondering, how can I *programmatical ly* learn the same information shown in the first example output, when Application_Err or event handler executes?
I'm using the .NET Framework 1.1 SP 1.
Thanks for your help!
Very cool. You're my hero! :)
I was able to cast Server.GetLastE rror().GetBaseE xception() to a
System.Web.Http CompileExceptio n in these cases, and pull the error details
from it, as you suggested (MSDN's doc examples were very helpful here).
Thanks for the help!
Out of curiosity, what's the reason why we see the "External component has
thrown an exception" error by default instead of something more detailed?
Thanks again.
"Nicole Calinoiu" wrote: If you cast the Exception to an HttpCompileExce ption (assuming the cast is possible <g>), it should be possible to read the error details (including line numbers) from the Errors collection of the CompilerResults object exposed via the exception's Results property.
HTH, Nicole "Plat" <Pl**@discussio ns.microsoft.co m> wrote in message news:C7******** *************** ***********@mic rosoft.com... I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax error. For example, broken.aspx might only contain the following line of code:
<% Dim x as %>
When I visit this page from my Web browser, I see all the helpful ASP.NET Server Error information, including:
Compilation Error Compiler Error Message: BC30182: Type expected. Source Error: Line 1: <% Dim x as %> Source File: c:\inetpub\mysi te\broken.aspx
This is great information; exactly what I need to troubleshoot the problem! However on my site, I trap the Exception in my Global.asax.vb' s Application_Err or handler so that I'm notified when an error occurs. Usually I'm able to cull useful information from the Exception, but in the event of a Compilation Error, here's all I can see:
System.Web.Http Exception: External component has thrown an exception. ---> System.Web.Http CompileExceptio n: External component has thrown an exception. at System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Comp ilation.BaseCom piler.GetCompil edType() at System.Web.UI.P ageParser.Compi leIntoType() at System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation() --- End of inner exception stack trace --- at System.Web.UI.T emplateParser.G etParserCacheIt emInternal(Bool ean fCreateIfNotFou nd) at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path() at System.Web.UI.T emplateParser.G etParserCacheIt em() at System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context, String requestType, String url, String path) at System.Web.Http Application.Map HttpHandler(Htt pContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) at System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute() at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean& completedSynchr onously)
The above is the result of "Server.GetLast Error().ToStrin g()" in my Application_Err or code.
So now I'm wondering, how can I *programmatical ly* learn the same information shown in the first example output, when Application_Err or event handler executes?
I'm using the .NET Framework 1.1 SP 1.
Thanks for your help!
System.Web.Http CompileExceptio n extends System.Web.Http Exception, which
extends System.Runtime. InteropServices .ExternalExcept ion. Neither
HttpCompileExce ption nor HttpException set their Message property. The only
constructor for HttpCompileExce ption runs through the default constructors
for the two base types mentioned above, so the first time a Message setter
is hit is the default constructor for ExternalExcepti on, which sets it to
the text you see in the exception details.
HTH,
Nicole
"Plat" <Pl**@discussio ns.microsoft.co m> wrote in message
news:76******** *************** ***********@mic rosoft.com... Very cool. You're my hero! :)
I was able to cast Server.GetLastE rror().GetBaseE xception() to a System.Web.Http CompileExceptio n in these cases, and pull the error details from it, as you suggested (MSDN's doc examples were very helpful here). Thanks for the help!
Out of curiosity, what's the reason why we see the "External component has thrown an exception" error by default instead of something more detailed?
Thanks again.
"Nicole Calinoiu" wrote:
If you cast the Exception to an HttpCompileExce ption (assuming the cast is possible <g>), it should be possible to read the error details (including line numbers) from the Errors collection of the CompilerResults object exposed via the exception's Results property.
HTH, Nicole "Plat" <Pl**@discussio ns.microsoft.co m> wrote in message news:C7******** *************** ***********@mic rosoft.com... > I've Googled this for a while, to no avail. Hopefully someone can help > me. > Maybe I'm using the wrong terminology. > > Here's the scoop! Let's say I've got a simple *.ASPX page that has a > syntax > error. For example, broken.aspx might only contain the following line > of > code: > > <% Dim x as %> > > When I visit this page from my Web browser, I see all the helpful > ASP.NET > Server Error information, including: > > Compilation Error > Compiler Error Message: BC30182: Type expected. > Source Error: Line 1: <% Dim x as %> > Source File: c:\inetpub\mysi te\broken.aspx > > This is great information; exactly what I need to troubleshoot the > problem! > However on my site, I trap the Exception in my Global.asax.vb' s > Application_Err or handler so that I'm notified when an error occurs. > Usually > I'm able to cull useful information from the Exception, but in the > event > of a > Compilation Error, here's all I can see: > > System.Web.Http Exception: External component has thrown an > exception. > ---> System.Web.Http CompileExceptio n: External component has thrown an > exception. > at > System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults > results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, > String > sourceFile, String sourceString) > at System.Web.Comp ilation.BaseCom piler.GetCompil edType() > at System.Web.UI.P ageParser.Compi leIntoType() > at > System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation() > --- End of inner exception stack trace --- > at System.Web.UI.T emplateParser.G etParserCacheIt emInternal(Bool ean > fCreateIfNotFou nd) > at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path() > at System.Web.UI.T emplateParser.G etParserCacheIt em() > at > System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String > virtualPath, String inputFile, HttpContext context) > at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng > virtualPath, String inputFile, HttpContext context) > at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing > virtualPath, String inputFile, HttpContext context) > at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context, > String requestType, String url, String path) > at System.Web.Http Application.Map HttpHandler(Htt pContext context, > String > requestType, String path, String pathTranslated, Boolean useAppConfig) > at > System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute() > at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, > Boolean& > completedSynchr onously) > > The above is the result of "Server.GetLast Error().ToStrin g()" in my > Application_Err or code. > > So now I'm wondering, how can I *programmatical ly* learn the same > information shown in the first example output, when Application_Err or > event > handler executes? > > I'm using the .NET Framework 1.1 SP 1. > > Thanks for your help!
Just incase:
I found some help in this reference: http://groups-beta.google.com/group/...899f56c254350f
*************** **********Here is what it
says*********** *************** ***********
It's hard to know but your Stack Trace implies that something goes
wrong
in the dynamic process of creating assembly that represent the page
HTML
definition. What I suggest:
1) Delete the cache of your application from asp.net temporary files
directory located under C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322.
2) Double check with source safe for changes between the last deployed
version and the current one in the pages HTML.
HTH
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Thanks.
HttpCompileExce ption ex = (HttpCompileExc eption)
ctx.Server.GetL astError().GetB aseException();
string txtError = ex.GetHtmlError Message().ToStr ing();
vb net
Dim exh As HttpCompileExce ption = Server.GetLastE rror.GetBaseExc eption()
Dim txtError As String = exh.GetHtmlErro rMessage().ToSt ring()
"Plat" escribió: I've Googled this for a while, to no avail. Hopefully someone can help me. Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax error. For example, broken.aspx might only contain the following line of code:
<% Dim x as %>
When I visit this page from my Web browser, I see all the helpful ASP.NET Server Error information, including:
Compilation Error Compiler Error Message: BC30182: Type expected. Source Error: Line 1: <% Dim x as %> Source File: c:\inetpub\mysi te\broken.aspx
This is great information; exactly what I need to troubleshoot the problem! However on my site, I trap the Exception in my Global.asax.vb' s Application_Err or handler so that I'm notified when an error occurs. Usually I'm able to cull useful information from the Exception, but in the event of a Compilation Error, here's all I can see:
System.Web.Http Exception: External component has thrown an exception. ---> System.Web.Http CompileExceptio n: External component has thrown an exception. at System.Web.Comp ilation.BaseCom piler.ThrowIfCo mpilerErrors(Co mpilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Comp ilation.BaseCom piler.GetCompil edType() at System.Web.UI.P ageParser.Compi leIntoType() at System.Web.UI.T emplateParser.G etParserCacheIt emThroughCompil ation() --- End of inner exception stack trace --- at System.Web.UI.T emplateParser.G etParserCacheIt emInternal(Bool ean fCreateIfNotFou nd) at System.Web.UI.T emplateParser.G etParserCacheIt emWithNewConfig Path() at System.Web.UI.T emplateParser.G etParserCacheIt em() at System.Web.UI.T emplateControlP arser.CompileAn dGetParserCache Item(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.T emplateControlP arser.GetCompil edInstance(Stri ng virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageParser.GetCo mpiledPageInsta nceInternal(Str ing virtualPath, String inputFile, HttpContext context) at System.Web.UI.P ageHandlerFacto ry.GetHandler(H ttpContext context, String requestType, String url, String path) at System.Web.Http Application.Map HttpHandler(Htt pContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) at System.Web.MapH andlerExecution Step.System.Web .HttpApplicatio n+IExecutionSte p.Execute() at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean& completedSynchr onously)
The above is the result of "Server.GetLast Error().ToStrin g()" in my Application_Err or code.
So now I'm wondering, how can I *programmatical ly* learn the same information shown in the first example output, when Application_Err or event handler executes?
I'm using the .NET Framework 1.1 SP 1.
Thanks for your help! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim Hansen |
last post by:
I re-installed Framework and now I am getting this error ClassBrowser. Most
other page work just fine. Additionally, the debugger will not start from
Visual Studio 2003..
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'SortTable' is...
|
by: Carpe Diem |
last post by:
Hello all.
My host is experiencing some troubles and I think you'll answer me before
they can.
After I uploaded a slightly changed JScript.NET .aspx page (the contents are
not important, could be just Response.End(); or anything) the page won't
load but instead shows this:
Server Error in '/' Application.
Compilation Error
|
by: Holger (David) Wagner |
last post by:
Hi Group,
I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.
Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like...
|
by: Praveen Ramesh |
last post by:
Hi,
Is there any way to add the @Assembly reference to the aspx files
programmatically from inside a custom control (when it gets dropped on to
the page from the toolbox)?
I have a custom control - MyControl that implements an interface in another
custom assembly - InterfaceAssembly. When MyControl gets dropped on to the
page and run, it results in a "InterfaceAssembly not found" exception. I am
aware that this can be fixed by...
|
by: bienwell |
last post by:
Hi,
I have a question about file included in ASP.NET. I have a file that
includes all the Sub functions (e.g FileFunct.vb). One of the functions
in this file is :
Sub TestFunct(ByVal strInput As String)
return (strInput & " test")
End Sub
| |
by: Stimp |
last post by:
I've created an aspx page called HistoryManage.aspx.
The page works fine on my local machine but when I load it off the web I
get the following strange error...
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
|
by: Ramesh2006 |
last post by:
Hi,
The following error occurred when i programmatically compile another project from my present project.
The Error:
error CS0234:The type or namespace name 'Windows' does not exist in the namespace 'System' <are you missing an assembly reference>
The Source Code:
|
by: rfinch |
last post by:
Very new to this but using the MS working with dynamics CRM 3.0 book to run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.
But am getting the following in ie 7.
Compiler Error Message: CS0234: The type or namespace name 'CrmSdk' does not
exist in the class or namespace 'WorkingWithCrm' (are you missing an assembly
reference?)
|
by: MCPD |
last post by:
hello
i have an aspx page that write in javascript
its too small file
when i upload it to my website i got an error
Server Error in '/' Application.
--------------------------------------------------------------------------------
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |