Question

I am trying to make a Cassini-like server for a particular asp.net web application. The Client is not happy with the Cassini interface, so I am just expanding the Cassini code, adding new features, and providing a fresh look to the UI.

Now the problem I am facing is, all the files from Cassini source use the System.Web.Hosting namespace. Visual Studio throws me an error saying:

The type or namespace name 'Hosting' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

What am I missing here? I have already written

using System.Web.Hosting;

in the first line of the .cs file. I am using .Net FW 3.5 and VS2008.

Any help would be seriously appreciated.

Thanks.

Was it helpful?

Solution

Most likely, your project is targeting the "Client Profile" version of the .NET Framework, which doesn't include the System.Web.Hosting namespace.

You need to change your project to target the full version of the framework, and then add a reference to System.Web. To do this, follow these steps:

  1. Open your project Properties by double-clicking on "Properties" in the Solution Explorer.

  2. From the drop-down box labeled "Target framework," choose ".NET Framework 3.5". Visual Studio will inform you that this requires closing and re-opening your project, so make sure that it is saved first before clicking "Yes".

  3. When your project re-opens, right click on "References" in the Solution Explorer, and select "Add Reference" from the context menu.

  4. Find the item named "System.Web" under the ".NET" tab in the resulting dialog box, and click OK.

OTHER TIPS

You have to add the System.Web reference to the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top