Question

Does anyone know how to access HttpRequest.Cookies within a static method with [WebMethod] attribute from an aspx.cs page?

It won't let me do it because method is static .

[WebMethod]
public static bool PostToTwitter(string identityUrl, string message, bool autoFollow)
{
  Page.Request.Cookies -- object reference is required for non-static field

Thanks!

Was it helpful?

Solution

Use,

HttpContext.Current.Request.Cookies
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top