request, session and application 'not defined'?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James R. Davis

    request, session and application 'not defined'?

    I am building a set of shared functions and subroutines in a vb file located
    in my App_Code section of my application. The first three functions went
    fine and work as expected. But I am now starting a subroutine that must
    work with certain server variables and I have been stopped cold.

    This is the code that frustrates me:

    Sub GetConfig()
    Dim strPathURL as string
    strPathURL = Left (Request.Server Variables("Path _Info"),
    InStrRev(Reques t.ServerVariabl es("Path_Info") , "/"))
    ....
    end Sub

    Visual Studio states that [Name 'Request' is not declared.]

    Indeed, it does the same for any statement I try that uses 'Request',
    'Server', 'Session' or 'Application'.

    I started the VB page with:
    Imports Microsoft.Visua lBasic

    Imports System.Data



    What more do I need to do? Thanks!!


  • Scott M.

    #2
    Re: request, session and application 'not defined'?

    The actual classes are: HTTPRequest, HTTPServer and HTTPSession. But, you
    can use Request, Server and Session if you have System.Web imported in your
    code. Do you?





    "James R. Davis" <Jim@msgroup.or gwrote in message
    news:u0qfFThVIH A.5208@TK2MSFTN GP04.phx.gbl...
    >I am building a set of shared functions and subroutines in a vb file
    >located
    in my App_Code section of my application. The first three functions went
    fine and work as expected. But I am now starting a subroutine that must
    work with certain server variables and I have been stopped cold.
    >
    This is the code that frustrates me:
    >
    Sub GetConfig()
    Dim strPathURL as string
    strPathURL = Left (Request.Server Variables("Path _Info"),
    InStrRev(Reques t.ServerVariabl es("Path_Info") , "/"))
    ...
    end Sub
    >
    Visual Studio states that [Name 'Request' is not declared.]
    >
    Indeed, it does the same for any statement I try that uses 'Request',
    'Server', 'Session' or 'Application'.
    >
    I started the VB page with:
    Imports Microsoft.Visua lBasic
    >
    Imports System.Data
    >
    >
    >
    What more do I need to do? Thanks!!
    >
    >

    Comment

    • James R. Davis

      #3
      Re: request, session and application 'not defined'?

      I did not have System.Web imported but when I added it there was no change
      whatever in the VS diagnostic.

      Further, when I tried changing the Request to HTTPRequest the diagnostic
      changed to:
      "Reference to a non-shared member requires an object reference"

      All I am trying to do is convert some ASP code to ASP.NET as a learning
      strategy. Your help is greatly appreciated.

      "Scott M." <smar@nospam.no spamwrote in message
      news:udL0pVhVIH A.5360@TK2MSFTN GP03.phx.gbl...
      The actual classes are: HTTPRequest, HTTPServer and HTTPSession. But, you
      can use Request, Server and Session if you have System.Web imported in
      your
      code. Do you?
      >
      >
      >
      >
      >
      "James R. Davis" <Jim@msgroup.or gwrote in message
      news:u0qfFThVIH A.5208@TK2MSFTN GP04.phx.gbl...
      I am building a set of shared functions and subroutines in a vb file
      located
      in my App_Code section of my application. The first three functions
      went
      fine and work as expected. But I am now starting a subroutine that must
      work with certain server variables and I have been stopped cold.

      This is the code that frustrates me:

      Sub GetConfig()
      Dim strPathURL as string
      strPathURL = Left (Request.Server Variables("Path _Info"),
      InStrRev(Reques t.ServerVariabl es("Path_Info") , "/"))
      ...
      end Sub

      Visual Studio states that [Name 'Request' is not declared.]

      Indeed, it does the same for any statement I try that uses 'Request',
      'Server', 'Session' or 'Application'.

      I started the VB page with:
      Imports Microsoft.Visua lBasic

      Imports System.Data



      What more do I need to do? Thanks!!
      >
      >

      Comment

      • Scott M.

        #4
        Re: request, session and application 'not defined'?

        You do have a reference to System.Web, right?


        "James R. Davis" <Jim@msgroup.or gwrote in message
        news:%23p6hoohV IHA.6044@TK2MSF TNGP05.phx.gbl. ..
        >I did not have System.Web imported but when I added it there was no change
        whatever in the VS diagnostic.
        >
        Further, when I tried changing the Request to HTTPRequest the diagnostic
        changed to:
        "Reference to a non-shared member requires an object reference"
        >
        All I am trying to do is convert some ASP code to ASP.NET as a learning
        strategy. Your help is greatly appreciated.
        >
        "Scott M." <smar@nospam.no spamwrote in message
        news:udL0pVhVIH A.5360@TK2MSFTN GP03.phx.gbl...
        >The actual classes are: HTTPRequest, HTTPServer and HTTPSession. But,
        >you
        >can use Request, Server and Session if you have System.Web imported in
        your
        >code. Do you?
        >>
        >>
        >>
        >>
        >>
        >"James R. Davis" <Jim@msgroup.or gwrote in message
        >news:u0qfFThVI HA.5208@TK2MSFT NGP04.phx.gbl.. .
        >I am building a set of shared functions and subroutines in a vb file
        >located
        in my App_Code section of my application. The first three functions
        went
        fine and work as expected. But I am now starting a subroutine that
        must
        work with certain server variables and I have been stopped cold.
        >
        This is the code that frustrates me:
        >
        Sub GetConfig()
        Dim strPathURL as string
        strPathURL = Left (Request.Server Variables("Path _Info"),
        InStrRev(Reques t.ServerVariabl es("Path_Info") , "/"))
        ...
        end Sub
        >
        Visual Studio states that [Name 'Request' is not declared.]
        >
        Indeed, it does the same for any statement I try that uses 'Request',
        'Server', 'Session' or 'Application'.
        >
        I started the VB page with:
        Imports Microsoft.Visua lBasic
        >
        Imports System.Data
        >
        >
        >
        What more do I need to do? Thanks!!
        >
        >
        >>
        >>
        >
        >

        Comment

        • =?Utf-8?B?TWlzYmFoIEFyZWZpbg==?=

          #5
          Re: request, session and application 'not defined'?

          Import System.Web and then use HttpContext.Cur rent.Request

          The static property Current on the HttpContext class can be useful whenever
          the flow of control leaves the code in your Page derived web form. Using this
          property you can reach out and magically grab the current Request, Response,
          Session, and Application objects (and more) for the request you are servicing


          --
          Misbah Arefin



          "James R. Davis" wrote:
          I did not have System.Web imported but when I added it there was no change
          whatever in the VS diagnostic.
          >
          Further, when I tried changing the Request to HTTPRequest the diagnostic
          changed to:
          "Reference to a non-shared member requires an object reference"
          >
          All I am trying to do is convert some ASP code to ASP.NET as a learning
          strategy. Your help is greatly appreciated.
          >
          "Scott M." <smar@nospam.no spamwrote in message
          news:udL0pVhVIH A.5360@TK2MSFTN GP03.phx.gbl...
          The actual classes are: HTTPRequest, HTTPServer and HTTPSession. But, you
          can use Request, Server and Session if you have System.Web imported in
          your
          code. Do you?





          "James R. Davis" <Jim@msgroup.or gwrote in message
          news:u0qfFThVIH A.5208@TK2MSFTN GP04.phx.gbl...
          >I am building a set of shared functions and subroutines in a vb file
          >located
          in my App_Code section of my application. The first three functions
          went
          fine and work as expected. But I am now starting a subroutine that must
          work with certain server variables and I have been stopped cold.
          >
          This is the code that frustrates me:
          >
          Sub GetConfig()
          Dim strPathURL as string
          strPathURL = Left (Request.Server Variables("Path _Info"),
          InStrRev(Reques t.ServerVariabl es("Path_Info") , "/"))
          ...
          end Sub
          >
          Visual Studio states that [Name 'Request' is not declared.]
          >
          Indeed, it does the same for any statement I try that uses 'Request',
          'Server', 'Session' or 'Application'.
          >
          I started the VB page with:
          Imports Microsoft.Visua lBasic
          >
          Imports System.Data
          >
          >
          >
          What more do I need to do? Thanks!!
          >
          >
          >
          >
          >

          Comment

          • James R. Davis

            #6
            Re: request, session and application 'not defined'?

            Thank you, Juan.

            You guys are very generous with your time and help. Much appreciated!

            James R. Davis


            Comment

            Working...