Global.asax – using directive, Debugging

A quick ASP.Net tip

1) If you want to use any custom namespace or class in your global.asax you can use following syntax to use corresponding namespace.

<%@ Import Namespace="TristonFramework.Web" %>

or

<%@ Import Namespace="System.Web" %>

 

2) When you put a breakpoint in Global.asax and if it not firing than consider following tips

   a. Make sure you are using Debug environment ie <compilation debug="true">

    Warning : make sure you have switched compilation element to false before using the web.config in production. Otherwise it has a huge performance panelty. You can read about it here.

 
b. Try to edit the Global.asax by just hitting few enters in blank space. Sometimes when Global.asax is not changed after last build, asp.net does not consider it for debugging. i dont know why ? But this trick works almost always.

 

Thanks and Regards,

Mahin Gupta


  • http://blog.ashishthakker.com/ Ashish P Thakker

    Hi Mahin,
    Thanks for sharing this…
    It helped many members in our company. :)

  • http://movieswatchonline.org/tag/720p 720p hd trailers

    Hey mate, your blog’s design is incredible and i like it. Your articles are incredible. Please keep them coming. Greets!!!

  • http://www.automaticraingauge.blogspot.com/ Katie. D