|
- <%
- Class HttpRequest
- Private m_Request
-
- Private Sub Class_Initialize()
- Set m_Request = Nothing
- End Sub
-
- Public Sub Bind(ByRef aspRequest)
- ' IsObject(Nothing) is True in VBScript, so it can't detect "no object"
- ' on its own - it must be paired with an explicit "Is Nothing" check.
- If (Not IsObject(aspRequest)) Or (aspRequest Is Nothing) Then
- Err.Raise vbObjectError + 1100, "HttpRequest.Bind", "aspRequest must be an object."
- End If
-
- Set m_Request = aspRequest
- End Sub
-
- Public Property Get IsBound()
- IsBound = Not (m_Request Is Nothing)
- End Property
-
- Public Function Item(ByVal key)
- EnsureBound "Item"
- Item = m_Request(CStr(key))
- End Function
-
- Public Function QueryString(ByVal key)
- EnsureBound "QueryString"
- QueryString = m_Request.QueryString(CStr(key))
- End Function
-
- Public Function Form(ByVal key)
- EnsureBound "Form"
- Form = m_Request.Form(CStr(key))
- End Function
-
- Public Function ServerVariable(ByVal key)
- EnsureBound "ServerVariable"
- ServerVariable = m_Request.ServerVariables(CStr(key))
- End Function
-
- Public Function Cookie(ByVal key)
- EnsureBound "Cookie"
- Cookie = m_Request.Cookies(CStr(key))
- End Function
-
- Public Function ClientCertificate(ByVal key)
- EnsureBound "ClientCertificate"
- ClientCertificate = m_Request.ClientCertificate(CStr(key))
- End Function
-
- Public Property Get TotalBytes()
- EnsureBound "TotalBytes"
- TotalBytes = m_Request.TotalBytes
- End Property
-
- Public Function BinaryRead(ByVal count)
- EnsureBound "BinaryRead"
- BinaryRead = m_Request.BinaryRead(CLng(count))
- End Function
-
- Private Sub EnsureBound(ByVal memberName)
- If m_Request Is Nothing Then
- Err.Raise vbObjectError + 1101, "HttpRequest." & CStr(memberName), "ASP Request object has not been bound."
- End If
- End Sub
- End Class
- %>
|