Metodo Web ASP.NET nella pagina aspx.cs non in grado di accedere all'oggetto Page.Request

StackOverflow https://stackoverflow.com/questions/1403038

  •  05-07-2019
  •  | 
  •  

Domanda

Qualcuno sa come accedere a HttpRequest.Cookies con un metodo statico con l'attributo [WebMethod] da una pagina aspx.cs?

Non mi permette di farlo perché il metodo è statico.

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

Grazie!

È stato utile?

Soluzione

Usa,

HttpContext.Current.Request.Cookies
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top