What is the difference between the three ASP.NET objects:
- HttpContext.Current.Request
- HttpContext.Request
- Request
Are these exactly the same?
Edit 1
Do these objects behave differently inside global.asax
/global.asax.vb
and default.aspx
/default.aspx.vb
.
Edit 2
OK I'll try to be specific this time. Which of the following should I use:
' File: global.asax
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
If Request.Url.Port = 80 Then
'If HttpContext.Current.Request.Url.Port = 80 Then
'If HttpContext.Request.Url.Port = 80 Then
'do something
End If
End Sub
' File: default.aspx
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Request.Url.Port = 80 Then
'If HttpContext.Current.Request.Url.Port = 80 Then
'If HttpContext.Request.Url.Port = 80 Then
'do something
End If
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…