I have a static class in my solution that is basically use a helper/ultility class.
In it I have the following static method:
// Set the user
public static void SetUser(string FirstName, string LastName)
{
User NewUser = new User { Name = String.Format("{0}{1}", FirstName, LastName) };
HttpCookie UserName = new HttpCookie("PressureName") { Value = NewUser.Name, Expires = DateTime.Now.AddMinutes(60) };
}
User is a simple class that contains:
String _name = string.Empty;
public String Name
{
get { return _name; }
set { _name = value; }
}
Everything works up until the point where I try to write the cookie "PressureName" and insert the value in it from NewUser.Name. From stepping through the code it appears that the cookie is never being written.
Am I making an obvious mistake? I'm still very amateur at c# and any help would be greatly appreciated.