aspx.cs页面中的ASP.NET Webmethod无法访问Page.Request对象

Ser*_*gey 3 asp.net httprequest webmethod

有没有人知道如何使用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
Run Code Online (Sandbox Code Playgroud)

谢谢!

ada*_*ost 13

使用,

HttpContext.Current.Request.Cookies
Run Code Online (Sandbox Code Playgroud)