Without bothering with the details (though if you are curious, I'll be
glad to explain!). This code functions perfectly under ASP.NET 1.1, but
randomly fails under ASP.NET 2.0. More details after the snippet
My site has the following web pages:
MainPage.aspx
Page1.aspx
Page2.aspx
Page3.aspx
Page4.aspx
The code behind file for MainPage looks like this:
Partial Class FinOpsCentral
Inherits System.Web.UI.Page
Dim appPages As New Hashtable
Private Sub Page_Load ...
appPages.Add(butPage1, "Page1")
appPages.Add(butPage2, "Page2")
appPages.Add(butPage3, "Page3")
appPages.Add(butPage4, "Page4")
If (Not IsPostBack) Then
Dim aspxPageType As Type
For Each pageObject As DictionaryEntry In appPages
aspxPageType = Type.GetType(pageObject.Value)
Next
End If
End Sub
....
End Class
By 'randomly fails', the GetType function will return Nothing on one of
the pages. If the solution is recomplied, GetType will return Nothing
for a page that (prior to recompiling) it returned its type.
The only difference between the 2.0 code and the 1.1 code is this:
Under 1.1, the GetType line read:
aspxPageType = Type.GetType("siteName." +
pageObject.Value)
I make heavy use of this construct in a number of my applications. It
works just fine for one of them (which has about six pages), but fails
on the others (which have about a dozen pages).
I haven't a clue as to why this is failing - I could really use your
help! Thanks.