我正在使用jquery,ajax,& .net来调用方法。我在网上看到很多例子,说[Webmethod]放在方法的上面,但是我一直在收到错误,找不到类型或名称空间名称'webmethod'。我已经把“使用System.Web.Services;”在顶部。还有什么需要做的?无法找到类型或名称空间名称'webmethod'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
public partial class _Default : System.Web.UI.Page
{
[WebMethod]
public static string GetDate()
{
return DateTime.Now.ToString();
}
}
我相信你的意思是只写'使用System.Web.Services;'就像我非常感谢神韵。 – Anicho 2011-10-21 09:35:04