Monday, February 06, 2006

Upgrade Asp.net app to V2.0

I upgraded an asp.net V1.1 app to V2.0 and VS2005 automatically converted my global.aspx.cs file so all the code is located in the App_Code folder. In order to use any of the static functions in the global class it is necessary to add "using Your_Global_Namespace;" to any class that uses any of the global functions.

This is required because any new web page generated by VS2005 does not seem to place the page class inside your global namespace. Something to do with partial classes?

VS2003 code generated for a new web page
namespace ARJ
{
public partial class BlahBlah : System.Web.UI.Page
{
}
}

VS2005 code generated for a new web page
public partial class BlahBlah : System.Web.UI.Page
{
}

you therefore need to add

using ARJ;

to any VS2005 web page that uses the any of the global functions.

No comments: