Does ASP.Net have an equivalent to this?

Discussion in 'ASP .Net' started by Jim Bancroft, Nov 20, 2004.

  1. Jim Bancroft

    Jim Bancroft Guest

    Hi all,

    I'm porting an ASP application to ASP.Net, and wondered if there was an
    equivalent to the COM Services' "ObjectContext" class.

    For instance, I'd like to port this code from VB6. It queries some ASP form
    values using the object context:


    //myComponent.cls

    Dim objContext As COMSVCSLib.ObjectContext
    Set objContext = GetObjectContext
    myVar = objContext("Request").Form("ValueXYZ")



    Is there a generally accepted way of doing the same thing, of "getting at"
    ASP.Net form variables in an existing assembly? Any tips or advice or links
    you could give me I'd appreciate, and thanks.

    -Jim
     
    Jim Bancroft, Nov 20, 2004
    #1
    1. Advertisements

  2. Jim, in your .NET component use:

    HttpContext.Current.

    And off you go. (i.e., HttpContext.Current.Request.Form["blah"], or
    HttpContext.Current.Response.Write("Foobar"))

    (Make sure your component has System.Web.dll in its References folder,
    and that you have using System.Web; (C#) or Imports System.Web (VB.NET)
    in the top of your class file!)

    Happy Programming!

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!
     
    Scott Mitchell [MVP], Nov 20, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.