Skip to main content


Showing posts from April, 2014

From your ASP App to the Compiler with Compilation Directives

If you have some code that you want to run locally for testing, you can check current "Request" and look at methods like "Request.IsLocal" to conditionally include test modules. However, there are times you need to bypass the ASP.NET application life cycle and directly exclude or include a source code from compiling using compilation directives. Here is an example of a use case where you might need to bypass the application life cycle in order to run code during development. Consider a case where you need to include some JS and CSS styles, say, you have QUnit   files stashed somewhere in a folder of your app, during development. If you are working on an ASP.NET page, view or controller you can access incoming HTTP Request by using: var currentRequest = Request; or if you are accessing the "Request" object from a class that does not inherit from "Page" in ASP.NET or "ViewPage" in MVC (or any other object that has the current