How to reference System.Web namespace?
When i writing: "System.W...", 开发者_运维问答the intellisence isn't show me "System.Web" why?
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.
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?
When i switch Build Action(of file *.cs) from "Content" to "Compile", my program began to work.
There could be various possibilities for such behavior:
- 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).
- 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"
Add a using statement as such:
using System.Web;
精彩评论