Go to home page mail me! RSS Feed
FoxMetrics Web Analytics

ASP.NET 2.0

Running IIS 7 in 32-bit mode

Its all nice and good when you are running all your websites in 64-bit, however, there are times when you need to run certain websites in 32bit – such as when you have a third party library that just doesn’t play nice in 64-bit. There are several workarounds - well, you can start by re-installing your OS in 32-bit, you could run the website in a 32-bit mode virtual machine, however, my favorite is to run IIS in 32-bit mode and here is how you do it. IIS PowerShell Provider set-itemproperty iis:\ -name applicationPoolDefaults.enable32BitAppOnWin64 -value true Command...

posted @ Wednesday, February 02, 2011 3:02 PM | Feedback (0)

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)

Get underlying type from a nullable type

As my forever quest for simple & reusable code keeps growing, I stumble across some bottlenecks once in a while. Anyway, I have a simple class that is called "PopulateObjectFromFormRequest" and as descriptive as the name is, it does one simple yet helpful task. Given an object as a generic type I.e (user) and a web form as a parameter I.e (aspnetform), it will scan through all the controls of that web form and use reflection on the object and assign values to the object properties that matches controls from within the form. How does this help me? Well if I my...

posted @ Tuesday, March 11, 2008 11:33 AM | Feedback (5)

Programmatically add META tags to your page header

At some point in time, especially when you are doing some serious SEO optimization, you may want to use separate titles, keywords, description and etc. for each page. Thanks, to .NET we can quickly create HtmlMeta controls programmatically and add them to the page header. Here is a quick and dirty snippet.     private void SetupPageHeader()    {        // Page title        Page.Title = GetGlobalResourceObject("resource","ApplicationWebTitle").ToString();                // Description meta tag        HtmlMeta descMeta = new HtmlMeta();        descMeta.Name = "Description";        descMeta.Content = GetGlobalResourceObject("resource", "MetaDescription").ToString();        Page.Header.Controls.Add(descMeta);                // Keywords meta tag        HtmlMeta keysMeta = new HtmlMeta();        keysMeta.Name = "keywords";        keysMeta.Content = GetGlobalResourceObject("resource", "MetaKeywords").ToString();        Page.Header.Controls.Add(keysMeta);    }  ...

posted @ Wednesday, November 28, 2007 10:59 AM | 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)

Building a custom ASP.NET paging control

As an IT Consultant with numerous number of projects that has to do with a lot of data which at the end of the day requires paging - I'm really tired of writing paging methods for every project. Therefore, on this nice beautiful Saturday I've decided that I'll knock out a paging control which I'll gladly call the Data Pager Control. It's almost inevitable to get a project these days that doesn't require some kind of data management. The two major aspects of web development that takes the majority of my time are: UI and Data Access. I've taken upon...

posted @ Sunday, October 14, 2007 12:47 PM | Feedback (3)

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)

Full ASP.NET 2.0 Archive

Next entries »