Go to home page mail me! RSS Feed

ASP.NET

Write out page load times using an HttpModule and the stopwatch class

One of the most efficient and non-intrusive ways you can implement an intercepting procedure is via an HttpModule. An HttpModule simply receives every request going to or coming from IIS and it allows you to manipulate the content as you see fit and pass it along. I wanted to spit out the time it takes from receiving a request to writing the response on one or more web pages and there was no other better way of doing it except writing an HttpModule, it toke me all but 10mins. Here is the code, feel free to blow it up. ...

posted @ Friday, July 24, 2009 1:40 PM | Feedback (0)

ASP.NET 1.1 to 2.0 conversion

I'm currently converting a huge 1.1 eCommerce site to 2.0 and its nothing but painful, apart from the stress of dealing with the original site lack of structure, there are some things that just don't work. These are my rumblings. I first tried converting the 2003 project to a 2005 website and that didn't go too well, after a few hours, I threw that idea out of the window and converted the project into a 2005 web application and it was a success apart from a few minor tweaks. Here are some other huddles that I had to jump. ...

posted @ Thursday, May 15, 2008 3:03 PM | Feedback (0)

ASP.NET MVC Source Code Now Available

Oh Yes! The ASP.NET source code is now available. Read more at ScottGu's blog. I like open source, no complaints. Next Steps: Our plans are to release regular drops of the source code going forward.  We'll release source updates every time we do official preview drops.  We will also release interim source refreshes in between the preview drops if you want to be able to track and build the source more frequently. We are also hoping to ship our unit test suite for ASP.NET MVC in the future as well (right now we use an internal mocking framework within our tests,...

posted @ Friday, March 21, 2008 1:55 PM | Feedback (0)

Re-throwing an exception

This is one of those "Yeah I've always seen people use it differently but I don't know why!" questions. Re-throwing exceptions can be misused, although it may not cause any harm to your application - there are multiple ways of re-throwing an exception, most likely for the purpose of bubbling it up to a higher level. Note to Java developers: It is different in your world. Lets look at how many ways we can use throw: throw throw ex throw new Exception();  You should not use #3 except if you are throwing a specific exception other...

posted @ Monday, November 05, 2007 9:06 PM | Feedback (13)

My Favorite Interview Questions

These are the questions that I usually ask during an interview process with an applicant that is in for a technical assessment interview. These questions assumes that you are well rounded and full blown .NET Web Developer. A .NET web developer should at least know ASP.NET, C#/VB.NET and TSQL.   What are HttpModules and HttpHandlers, and what is the difference between the two? What is the difference between CREATE PROC and CREATE PROCEDURE? What is ViewState and what are its advantages and disadvantages? ...

posted @ Friday, November 02, 2007 2:40 PM | Feedback (34)

Check for internet connection - Method #2

 A better and cleaner way for checking for an active internet connection. see http://blog.dotnetclr.com/archive/2007/08/30/Check... for the older version. 1: /// <summary> 2: /// Performs actions on the network 3: /// </summary> 4: public sealed class NetworkHandler 5: { 6: /// <summary> 7: /// Private constructor to prevent compiler from generating one 8: /// since this class only holds static methods and properties 9: /// </summary>...

posted @ Monday, September 24, 2007 10:32 AM | Feedback (1)

Microsoft Delivers Silverlight 1.0 and Extends Support to Linux.

Microsoft Silverlight is on the loose.     While you are at it, check out http://www.mono-project.com/MoonlightShots   Link to Microsoft Delivers Silverlight 1.0, Extends Support to Linux: “Entertainment Tonight” HSN and World Wrestling Entertainment showcase new online experiences; more than 35 partners commit to Silverlight Partner Initiative.

posted @ Wednesday, September 05, 2007 6:08 AM | Feedback (0)

C# - Get short month name from month int value

 Ok, I've been asked one too many times about how to convert a month int value to a short or long month name - so here goes nothing.   1: /// <summary> 2: /// Start program 3: /// </summary> 4: /// <param name="args">Arguaments not required</param> 5: static void Main(string[] args) 6: { 7: for (int month = 1; month < 13; month++) 8: { 9: ...

posted @ Monday, July 02, 2007 9:52 AM | Feedback (5)

Copying nodes from one XML document to another

I spent a few hours yesterday trying to copy nodes from one xml document to another. The problem is this - there is a transport tool that transport XML documents from one server to the other and it works well, however, if the XML document(s) is large say over 15mb the transport tool fails. While trying not to rewrite the code, I decided that the most efficient way to solve the problem is to split the xml file in multiple files (chunks). The format of the document should remain the same and the 7 headers should be included in all chunks...

posted @ Wednesday, May 09, 2007 11:19 AM | Feedback (0)

Starting a new thread with parameters

In the days of v1.1, the need to start a new thread with parameters almost arises on every instance - there was no way, at least none that I know of. However, v2.0 of the .Net Framework allows you to start a new thread and also pass a parameter to it. It doesn't get any better. I have been messing around with some threading recently and it came in handy. Sample code:   private void BeginThreading() { ...

posted @ Sunday, April 15, 2007 6:18 PM | Feedback (12)

Full ASP.NET Archive

Next entries »