How to reference System.Web namespace?

9.5k views Asked by At

When i writing: "System.W...", the intellisence isn't show me "System.Web" why? enter image description here

5

There are 5 answers

2
Glebka On BEST ANSWER

When i switch Build Action(of file *.cs) from "Content" to "Compile", my program began to work.

1
tzup On

Add a using statement as such:

using System.Web;
1
RichardW1001 On

You have no reference to the assembly. Right click your project, Add Reference and add System.Web. You might also need to switch to targeting the full framework, which is in Projetc settings under Compile, in the Advanded dialog, it's the bottom dialog.

2
Davide Piras On

could it be because you are not in a Web Project?

what does it happen if you anyway create an object of System.Web namespace and build the project then try to edit your code?

0
Tahir77667 On

There could be various possibilities for such behavior:

  1. You might have missed referencing some essential assemblies; because there is no .NET without these two things i.e BCL(Base Class Libraries) & CLR(Common Language Runtime).
  2. Wrong targeting of .NET Framework version. If you target .NET 3.5 or 4 client profile, you won't see ASP.NET assemblies.Solution, go to: Project > Properties > Target Framework. Change it from

".NET Framework 4 Client Profile" to ".NET Framework 4"