Home Contact RSS

Why Does Server.GetLastError() Return NULL

If .NET Framework insist on not telling you what the exception was then you have to start checking Context.AllErrors.

I wanted to check what can be the reason to make GetLastError() method angry with myself and tried search engines to see what other people say about it. Most of the people keep writing that GetLastError method of Server object returns null if you want to call it inside a page’s load or in the error page that causes a redirection and makes you loose the Exception object.

Well, I really don’t try to implement a page specific error handling architecture. What I am doing is simply trying to access the last error within the Error event of the Context instance in my custom IHttpModule.

Read the rest of this entry »

VirtualPathProvider In Precompiled Web Sites

After finishing a project and deploying it on a public server, it is normal that you expect some problems or to-dos like some configuration changes in “web.config” file or somewhere else if you preferred implementing your own configuration architecture.

The question is that if you would expect something to break depending on your choice of deployment, e.g. Precompiled deployment or not. My answer was no until 3 days ago but it is a screaming “YES” for now.

What I am talking about is System.Web.Hosting.VirtualPathProvider class located in System.Web assembly. This class insists on not registering itself to the HostingEnvironment (System.Web.Hosting.HostingEnvironment) if you prefer deploying your website using precompilation.

Read the rest of this entry »