| |
 |
Monday, March 11, 2002 |
COM and ASP debugging
I've finally learned how to debug a C++ COM component called by ASP. I don't know why I've avoided it for so long. I suppose because I test my COM components with quick VB test apps, so they generally work fine by the time I call them from ASP. This time was different (it works from VB but not from ASP).
I've been immersed in Keith Brown's most excellent book, so I actually know what the difference is! When running from VB, the security token is from the interactive logon, i.e. me running as an administrator (but I will follow Keith's advice soon and break that bad habit, I promise). When run from ASP, the component is running under ISR_WONKO, who is merely a guest. So the required authorization is not there. QED. Keith's very useful TokenDump component, available here, showed me the security token being used for various security settings in IIS.
Debugging the COM component was as simple as watching DLLHOST appear in the Task Manager when I went to the page in the browser and selecting Debug from the right button menu (in Task Manager). Then opening the file in Visual Studio, setting the breakpoint, and refreshing the page. Beautiful. It's been a fine afternoon.
5:08:18 PM
|
|
Don't take any chances with ASP caching:<% Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" %>
12:52:22 PM
|
|
Maybe I'll start with a quick review of a book I've just finished - Applied Microsoft .NET Framework Programming by Jeffrey Richter. There are many smart people in our industry and lots of them share their intelligence with us through writing and speaking. In my view, Richter is the best of them, not for how smart he is, but for how much smarter he makes me. No other writer conveys so much.
His chapter on Exceptions, is a good example. I've used them for many years, in C++ and JavaScript, so I expected to learn just the C# syntax. And he starts with that, of course. But then he has eight pages on "How to Use Exceptions Properly", including an error I'm guilty of: Don't Catch Everything:
catch (Exception) { ... }
"This code indicates that it was expecting any and all exceptions and knows how to recover from any and all situations. How can this possibly be?"
I hope he is even now writing the sequel, about Collections, Threading, Remoting, Messaging.
11:06:44 AM
|
|
© Copyright 2004 John Sands.
|
|
|
|
| March 2002 |
| Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
| |
|
|
|
|
1 |
2 |
| 3 |
4 |
5 |
6 |
7 |
8 |
9 |
| 10 |
11 |
12 |
13 |
14 |
15 |
16 |
| 17 |
18 |
19 |
20 |
21 |
22 |
23 |
| 24 |
25 |
26 |
27 |
28 |
29 |
30 |
| 31 |
|
|
|
|
|
|
| Feb Apr |
|
|