aspx.cs 페이지의 asp.net webmethod 페이지에 액세스 할 수 없습니다.
-
05-07-2019 - |
문제
ASPX.CS 페이지에서 [WebMethod] 속성이있는 정적 메소드 내에서 httprequest.cookies에 액세스하는 방법을 아는 사람이 있습니까?
메소드가 정적이기 때문에 그렇게하지 않을 것입니다.
[WebMethod]
public static bool PostToTwitter(string identityUrl, string message, bool autoFollow)
{
Page.Request.Cookies -- object reference is required for non-static field
감사!
해결책
사용,
HttpContext.Current.Request.Cookies
제휴하지 않습니다 StackOverflow