1
Public Enum webpages
2
yet_test1
3
yet_test2
4
yet_m_test2
5
yet_m_test1
6
End Enum
7
8
<ToolboxData("<{0}:Forum runat=""server""></{0}:Forum>")> _
9
Public Class class1
10
Inherits System.Web.UI.UserControl
11
12
Private Sub Forum_load(ByVal sender As Object, ByVal e As EventArgs)
13
Dim webpages1 As webpages
14
Dim m_baseDir As String = config.ConfigSection.Item("root")
15
Try
16
webpages1 = CType([Enum].Parse(GetType(webpages), MyBase.Request.QueryString.Item("g"), True), webpages)
17
Catch ex As Exception
18
webpages1 = webpages.yet_m_test1
19
End Try
20
Dim src As String = String.Format("{0}/{1}.ascx", m_baseDir, webpages1)
21
22
'Try
23
' Dim webpage As ForumPage = CType(MyBase.LoadControl(src), ForumPage)
24
' webpage.ForumControl = Me
25
' Me.Controls.Add(webpage)
26
'Catch exception2 As System.IO.FileNotFoundException
27
' Throw New ApplicationException(("Failed to load " & m_baseDir & "."))
28
'End Try
29
30
31
32
End Sub
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1
Private m_section As System.Xml.XmlNode
2![]()
3
Public Sub config(ByVal node As System.Xml.XmlNode)
4
m_section = node
5
End Sub
6![]()
7
Public ReadOnly Property Item(ByVal key As String) As String
8
Get
9
Dim node As System.Xml.XmlNode = m_section.SelectSingleNode(key)
10
If Not node Is Nothing Then
11
Return node.InnerText
12
Else
13
Return Nothing
14
End If
15
End Get
16
End Property
17![]()
18
Public Shared ReadOnly Property ConfigSection() As config
19
Get
20
Dim config1 As config = CType(ConfigurationSettings.GetConfig("yafnet"), config)
21
If (config1 Is Nothing) Then
22
Throw New ApplicationException("Failed to get configuration from Web.config")
23
Else
24
Return config1
25
End If
26
End Get
27
End Property
1
Private m_section As System.Xml.XmlNode
2![]()
3
Public Sub config(ByVal node As System.Xml.XmlNode)
4
m_section = node
5
End Sub
6![]()
7
Public ReadOnly Property Item(ByVal key As String) As String
8
Get
9
Dim node As System.Xml.XmlNode = m_section.SelectSingleNode(key)
10
If Not node Is Nothing Then
11
Return node.InnerText
12
Else
13
Return Nothing
14
End If
15
End Get
16
End Property
17![]()
18
Public Shared ReadOnly Property ConfigSection() As config
19
Get
20
Dim config1 As config = CType(ConfigurationSettings.GetConfig("yafnet"), config)
21
If (config1 Is Nothing) Then
22
Throw New ApplicationException("Failed to get configuration from Web.config")
23
Else
24
Return config1
25
End If
26
End Get
27
End Property
Private m_section As System.Xml.XmlNode2

3
Public Sub config(ByVal node As System.Xml.XmlNode)4
m_section = node5
End Sub6

7
Public ReadOnly Property Item(ByVal key As String) As String8
Get9
Dim node As System.Xml.XmlNode = m_section.SelectSingleNode(key)10
If Not node Is Nothing Then11
Return node.InnerText12
Else13
Return Nothing14
End If15
End Get16
End Property17

18
Public Shared ReadOnly Property ConfigSection() As config19
Get20
Dim config1 As config = CType(ConfigurationSettings.GetConfig("yafnet"), config)21
If (config1 Is Nothing) Then22
Throw New ApplicationException("Failed to get configuration from Web.config")23
Else24
Return config125
End If26
End Get27
End Property

浙公网安备 33010602011771号