|
As far as debugging difficulty goes, anything that you can reproduce and step through with the debugger is likely simple. Sometimes you'll get an error that occurs before the codebehind is even hit, and you therefore can't debug it like "normal". One such error is: "System.Web.HttpException: External component has thrown an exception."
Web pages integrate both the aspx and codebehind pages. What may be happening is that some control in the html of the aspx page has an onserver attribute that references a non-existent server event. For example, you may have copied from a similar page that had a LinkButton with attribute onserverclick="AddLink_Click". The WebForm expects an "AddLink_Click" method in the codebehind. The original page may have had this method, but perhaps the target page does not. Therefore when you try to load the page, it can't "merge" the aspx and codebehind correctly and therefore crashes before even going to a breakpoint in the CodeBehind's Page_Load.
The solution (in this case) is to ensure that any attributes set in the aspx page are consistent with the codebehind.
When next in Australia, IOU one beer! I thought I had kept track of the
inconsistency, but your article made me double check. Cheers.
stuff like this is always helpful. Thanks for the lead.
If you are sure that the program is fine then there could be one reason to
this problem. You should check if the assemblies loaded in w3wp process are
loaded from correct locations or not? It can happen that the assembly
containing the code is loaded from wrong location. This can be checked by a
tool called "listdlls".
I hate the sentence 'System.Web.HttpException'. This article moves on diff
ways.
Control 'dgrdItemDetails__ctl2_chkDelete_Header' of type 'CheckBox' must be
placed inside a form tag with runat=server.
Thanks for the hint mate. You helped me big time!
I also had this error and nothing worked. I removed code and html, still
same error appeared. The fix was remove all temorary files under the
framework for this application. This may not be simple, as in typical
windows fashion it says it is in use. Delete the directory in command
prompt with explorer task termintaed. Not saying it will work for
everybody, but I know how frustrating it is when nothing works and this is
always something to try.
Cheers Ronny, I had this problem and that worked out for me. Rather than
massacring the explorer task you can just kill the asp.net worker process
and then remove the files.
<tr>
<td><%# DataBinder.Eval(Container.vReport, "Name")
%></td>
</tr>
After half an hour of searching the net for a solution I thought I could
just restart my pc.
Yes that worked for me....
Saved me a boatload of time. Thanks!
Your article is still saving people from a lot of headaches. It just saved
me a ton. Thank you very much.
When ever in Danmark (or Israel), three beers are on me.
I had the problem of copying a button statement which calls it's sub
through a JS call (don't ask me why - it's from an older code that due to
much required test and validation, i didn't want to change).
The problem was that the button sub was declared (as it it's normaly is) as
Private.
So after reading your explenation for the exception, and going
through the code again, i found that and changed it to Protected.
Thakn again.
I got this error when I put the master page code-behind in the same
namespace as the rest of the project. Don't understand that.
That was really great find. It helped me when i was facing this error and
was clueless. Thanks for that.
I have just had a version of this. Tried to compile and got the error
"External component has thrown an exception." popping up when i did a build
web site. My solution was to copy all the files I had edited recently into
a safe directory outside the project. Then delete the files I had backed
up. I deleted them through the project explorer within vwd2008 just in case
the ide took an extra step of deleting corrupt temporary files. Then I
dragged each combo back until the error occurred again. It turned out it
was freaking out over an ascx usercontrol. I took the code out of the
control and put it back into the page as I wasnt using it anywhere else
anyway. I had recently renamed the source files for this control and then
just changed the class name at the top. I dont know if that was what had
caused the problem or not.