Page的 Context属性跟HttpContext.Current引用相等的
这是用reflector查看到的代码。
这是用reflector查看到的代码。
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
|
protected
internal
override
HttpContext Context
{
[TargetedPatchingOptOut(
"Performance critical to inline across NGen image boundaries"
)]
get
{
if
(
this
._context ==
null
)
{
this
._context = HttpContext.Current;
}
return
this
._context;
}
}
public
virtual
HttpSessionState Session
{
get
{
if
(!
this
._sessionRetrieved)
{
this
._sessionRetrieved =
true
;
try
{
this
._session =
this
.Context.Session;
}
catch
{
}
}
if
(
this
._session ==
null
)
{
throw
new
HttpException(SR.GetString(
"Session_not_enabled"
));
}
return
this
._session;
}
}
|