-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAspPage.vb
63 lines (53 loc) · 1.54 KB
/
AspPage.vb
1
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Imports System.Web
Imports System.Web.UI
Imports System.Web.SessionState
Public Class AspPage
Inherits Page
Private _HttpApplication As System.Web.HttpApplication
Public Overrides ReadOnly Property Session As HttpSessionState
Get
If (Not _HttpApplication Is Nothing) Then
Return _HttpApplication.Session
End If
Return MyBase.Session
End Get
End Property
Public ReadOnly Property Application As System.Web.HttpApplicationState
Get
If (Not _HttpApplication Is Nothing) Then
Return _HttpApplication.Application
End If
Return MyBase.Application
End Get
End Property
Public ReadOnly Property Server As System.Web.HttpServerUtility
Get
If (Not _HttpApplication Is Nothing) Then
Return _HttpApplication.Server
End If
Return MyBase.Server
End Get
End Property
Private classCache As Dictionary(Of String, PageClass) = New Dictionary(Of String, PageClass)
Public Function createInstance(What As System.Type) As PageClass
Dim classInstance As PageClass = Nothing
SyncLock classCache
If Not classCache.TryGetValue(What.ToString(), classInstance) Then
classInstance = Activator.CreateInstance(What, Me)
classCache.Add(What.ToString(), classInstance)
End If
End SyncLock
Return classInstance
End Function
Function Response_WriteLine(Str As String)
If Not Response Is Nothing Then
Response.Write(Str & vbCrLf)
End If
End Function
Public Sub New()
MyBase.New()
End Sub
Public Sub New(HttpApplication As System.Web.HttpApplication)
Me._HttpApplication = HttpApplication
End Sub
End Class