aspx.csページのASP.NET WebmethodがPage.Requestオブジェクトにアクセスできない

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

  •  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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top