namespace X{ public static class URLs
{
public static TabController tabIdLookUp = new TabController();
public static string DASHBOARD_AUDIT_PAGE = tabIdLookUp.GetTabByName("View My Safety", 2).TabID.ToString();
public static string URL_GENERATE_WITH_MID(String TabName, int PortalId){ {
return tabIdLookUp.GetTabByName(TabName, PortalId).TabID.ToString();
}
}}
... in my user control i do this:
Response.Redirect("/" + X.URLs.URL_GENERATE_WITH_MID("test", 1)); // this causes the error
the error is: The type initializer for 'X.URLs' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object. at X.URLs..cctor()
can't debug because it works on my local box, but throws that error on the server.
any ideas?
P.S. the problem ended up being a trivial NUllReferenceException - GetTabByName() was returing NULL