system.web and HttpContext

  • Thread starter Thread starter Gilgamesh
  • Start date Start date
G

Gilgamesh

We're developing a C# assemlbly in .net 2.0 and we don't see HttpContext
class in System.Web.
Anybody knows what happened to it? We need HttpContext in order to access
the Request object.

Thanks,
GIlgamesh
 
Gilgamesh said:
We're developing a C# assemlbly in .net 2.0 and we don't see HttpContext
class in System.Web.
Anybody knows what happened to it? We need HttpContext in order to access
the Request object.

It is there, I've used it lots of times. Are you sure that you have added
the System.Web.dll assembly to your project References?
 
Yes. Are you sure you're not talking about asp.net application? In my case,
it's a C# assembly.
-G
 
Gilgamesh said:
Yes. Are you sure you're not talking about asp.net application? In my
case, it's a C# assembly.

If it were an asp.net application you would not need to go into the
References to add System.Web.dll, because the standard template for asp.net
already contains the reference. It is only when you create a new class
library that you need to add the Reference.

I assume that when you say "a C# assembly" you are referring to a class
library to be called from an asp.net application, since otherwise it
wouldn't make sense to use HttpContext. Note that an .exe file is also an
assembly and that an asp.net application also gets compiled into an assembly
when you run it.

Anyway, I've just done it: I went into one of my projects in Visual Studio
2005, selected "Add Reference" and added System.Web, then went into one of
the .cs files in the project and added "using System.Web;", then typed
"HttpContext." in the source code, and it was immediately recognized by
Intellisense.
 
It worked. Thanks a lot!
-G
Alberto Poblacion said:
If it were an asp.net application you would not need to go into the
References to add System.Web.dll, because the standard template for
asp.net already contains the reference. It is only when you create a new
class library that you need to add the Reference.

I assume that when you say "a C# assembly" you are referring to a class
library to be called from an asp.net application, since otherwise it
wouldn't make sense to use HttpContext. Note that an .exe file is also an
assembly and that an asp.net application also gets compiled into an
assembly when you run it.

Anyway, I've just done it: I went into one of my projects in Visual
Studio 2005, selected "Add Reference" and added System.Web, then went into
one of the .cs files in the project and added "using System.Web;", then
typed "HttpContext." in the source code, and it was immediately recognized
by Intellisense.
 
Back
Top