Little lost right now...
I am following the following article to test/learn nested layouts. http://blogs.msdn.com/b/marcinon/archive/2010/12/15/razor-nested-layouts-and-redefined-sections.aspx
And i am getting the following error:
The type 'System.Web.IHtmlString' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. D:\Projects\Mvc3\Tests\RazorLayouts\Layout.MvcBase\Extensions\SectionExtensions.cs 15 36 Layout.MvcBase
I have name space System.Web referenced... and the blue line is on "RenderSection". public static HelperResult RenderSection
Check everything is using the same version of the framework (eg. you're not referencing 3.5 of System.Web), and also whether you've had any beta versions installed, which might have slightly different versions.
If you can't do that, can you provide a zip file of your project (be sure to remove any sensitive information, such as API keys, connection strings etc.) that we could look at?
Edit: Just a thought - you said you had the namespace System.Web referenced. This is not the same as the assembly System.Web. It's possible you can import the namespace without the assembly, as classes in other assemblies (eg. System.Web.Mvc) can include the namespace. Make sure in your Assembly references folder you can see "System.Web".
I had your same problem. I've added System.Web assembly, but not from add reference. I did double click on one assembly in reference folder and it open a new tab, form here i selected the correct version of .net and i added the specific assembly version and all work correctly. In my case i use .net 4.0. I hope help you.
I just had this issue. You may need to add a reference to "System.Web" as well. That fixed it for me. Remember, not just the "using" statement, but actually adding a reference to it. I ran into this issue while setting up a test project for my controllers.