title: w-s in .aspx (code-behind) tries to set cookie but can't?
body: <p>I have a web-service, 'AHandyWebService' implemented within a .aspx (<strong>not</strong> within the .aspx.cs). </p>
  
  <p>I'm trying to set a cookie on the client when the web-service is called.</p>
  
  <p>I'm not sure whether this is just intrinsically impossible or whether it's something to do with the way I've done it. </p>
  
  <p>Because the method implementing the w-s is static I've had to implement a local instance of 'page' which I'm not sure is quite as it should be.</p>
  
  <p>Method looks like this :</p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
  public static SomeObj AHandyWebService()
  {
      SomeObj mySomeObj;
      try
      {
          mySomeObj = getSomeObj();
          System.Web.UI.Page p = new Page();
          HttpCookie appCookie = new HttpCookie("FOOAPP");
          appCookie.Value = String.Format("Written: {0:yyyy-MM-dd}", System.DateTime.Now.ToUniversalTime());
          appCookie.Expires = System.DateTime.Now.ToUniversalTime().AddMinutes(1);
          appCookie.Path = "/FOO";
          p.Response.Cookies.Add(appCookie);
  
      }
      catch (Exception ex)
      {
          throw;
      }
  
      return mySomeObj;
  
  }
  </code></pre>
  
  <p>By the way there are no cross-domain issues here - the w-s is provided from the same domain as the w-s consuming page was served from.</p>
  
  <p>Would welcome suggestions/comments.</p>