Namespace reference to use for 'UmbracoContext.Current.Response.Cookies'
Hi,
This is following on from an earlier thread but the issue has evolved a little. Basically, I have this code:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using umbraco; using umbraco.presentation;
namespace myproject { public partial class SetCookie : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (library.IsLoggedOn()) { Label1.Text = "Logged in"; } else { if (string.IsNullOrEmpty(UmbracoContext.Current.Request.Cookies["visitorGUID"].Value)) { Guid myguid = Guid.NewGuid(); UmbracoContext.Current.Response.Cookies["visitorGUID"].Value = myguid.ToString(); } }
} } }
However, when I try to build it, it errors, saying "You must add a reference to assembly 'System.Web.Abstractions'". I've tried adding the namespace reference System.Web.Abstractions but it in turn errors saying "The type or namespace name 'Abstractions' does not exist in the namespace 'System.Web'". Seems like I can't win ;)
Does anyone know what namespaces to reference in order to get this to work, or is there a more fundamental problem?
Thanks Slace, I've now added 'System.Web.Absctractions' to the references folder in my project, and added the reference in the code-behind page again, and it still errors: "Error 3 The type or namespace name 'Abstractions' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)". Is there a dependency on another namespace, or do I need to somehow refresh the project to make that assembly open to reference now?
I'm probably doing something blindingly obviously wrong, but I'm a noob at all this, so your patience is appreciated!
Namespace reference to use for 'UmbracoContext.Current.Response.Cookies'
Hi,
This is following on from an earlier thread but the issue has evolved a little. Basically, I have this code:
However, when I try to build it, it errors, saying "You must add a reference to assembly 'System.Web.Abstractions'". I've tried adding the namespace reference System.Web.Abstractions but it in turn errors saying "The type or namespace name 'Abstractions' does not exist in the namespace 'System.Web'". Seems like I can't win ;)
Does anyone know what namespaces to reference in order to get this to work, or is there a more fundamental problem?
Thanks all.
You need to reference the System.Web.Abstractions assembly in your project.
UmbracoContext uses the abstract implementation of the Http* objects, which were initially written for ASP.NET MVC
Thanks Slace, I've now added 'System.Web.Absctractions' to the references folder in my project, and added the reference in the code-behind page again, and it still errors: "Error 3 The type or namespace name 'Abstractions' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)". Is there a dependency on another namespace, or do I need to somehow refresh the project to make that assembly open to reference now?
I'm probably doing something blindingly obviously wrong, but I'm a noob at all this, so your patience is appreciated!
Cheers
Are you using .NET 3.5 or .NET 4.0?
Did you ensure you referenced the correct version of the assembly for the runtime type?
is working on a reply...