Does ASP.Net have an equivalent to this?


J

Jim Bancroft

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
 
Ad

Advertisements

S

Scott Mitchell [MVP]

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
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 

Top