locked
Request.Cookies - Name 'Request' is not declared RRS feed

  • Question

  • User-1481524302 posted

    Ignorance is not bliss.  I've moved some vb.net 2.0 code from a web page to a class.  Now it's throwing the error that Request is not declared.  When I look in the help, it says that Request is part of the System.Web namespace.  I've added it to my References and to the page in an Imports statement.  No dice.  Still not seeing it.

    What am I missing?

    Thanks in advance.

    Thursday, October 25, 2007 12:28 PM

Answers

  • User-451145732 posted

    Hi

    You are not missing anything.

    just use HttpContext.Current.Request.Form

    Like this in the class

    Public Function GetTextRequest(ByVal yy As TextBox) As String

     Dim stra As String
     stra = HttpContext.Current.Request.Form(yy.UniqueID)
     Return stra

    End Function

    I think this will help you.

    Regards
    Shirish Bhavthankar

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 25, 2007 1:06 PM

All replies

  • User-694963578 posted

    You may need to pass the request object into the sub or function, unless your class is inheriting System.Web.UI.Page

    Thursday, October 25, 2007 12:56 PM
  • User-451145732 posted

    Hi

    You are not missing anything.

    just use HttpContext.Current.Request.Form

    Like this in the class

    Public Function GetTextRequest(ByVal yy As TextBox) As String

     Dim stra As String
     stra = HttpContext.Current.Request.Form(yy.UniqueID)
     Return stra

    End Function

    I think this will help you.

    Regards
    Shirish Bhavthankar

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 25, 2007 1:06 PM
  • User-1481524302 posted

    Why does it need the additional info in the class and it doesn't in the website version?

    Thursday, October 25, 2007 1:50 PM
  • User-451145732 posted

    Because by default all websites developed in Visual Studio 2005 is Inherited from System.Web.UI.Page and Class files won't that's the resion we have to add System.Web.UI.Page namespace in the class file.

    Regards
    Shirish Bhavthankar

     

     

     

    Thursday, October 25, 2007 2:30 PM
  • User-1481524302 posted

    Thanks.  The learning curve is steep and I'm trying to understand why things work the way they do.

    Thursday, October 25, 2007 3:24 PM