Quantcast
Channel: .Net Smoothie » Visual Studio
Viewing all articles
Browse latest Browse all 7

The Value of Being Free to See the Source

$
0
0

Since the source code to ASP.Net was made available, I’ve been using it extensively. Here’s a great example of why it’s so valuable.

I’ve been trying to integrate the Enterprise Library 3.1 Exception Handling Block into my application. My application is split into a core and web UI specific components, so I’ve defined errors in my code to be thrown when a resource is not available. The web application configuration file specifies that if a specific exception, e.g. a ResourceNotFoundException, is thrown, the Exception Handling Block should replace that exception with a 404 Resource Not Found error using Http. That should in turn use the CustomErrors feature to redirect to a 404 not found page.

Makes sense, and sounds simple, don’t you think?

Nothing in the docs says that it shouldn’t work.

But it doesn’t. It simply won’t work. Why? Well, there’s nothing on the web. But after spending some serious hours digging through the source code, I can finally see why.

Here’s a lovely little hidden-to-the-world snippet of the code I got inside of Visual Studio:

code = HttpException.GetHttpCodeForException(e);

// Don't raise event for 404.  See VSWhidbey 124147.
if (code != 404) {
  WebBaseEvent.RaiseRuntimeError(e, this);
}

So it would never work!

Nice of them to let me know.


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images