2011-11-07 3 views
2

私のいくつかの私のajaxをGoogleに見えるようにしています。そのためには、クエリ文字列(エスケープされたフラグメント)に基づいてコンテンツのhtmlスナップショットを提供する必要があります。問題は、私のHTMLのいくつかがwebservices呼び出しによって返されることです。メソッドのようにaspnet webserviceを呼び出す

のように私は、内部のwebMethodsとSite.ajax._searchというクラスを、持っている:

[WebMethod(EnableSession = true)] 
public string ReadSearch(string nm_what, string nm_where, int pageindex) 
{ 
} 

答えて

1

はい、それは私もそれが静的になるだろう、大丈夫です:

[WebMethod(EnableSession = true)] 
public static string ReadSearch(string nm_what, string nm_where, int pageindex) 
{ 
} 

//from another page 
protected void Page_Load(object sender, EventArgs e) 
{ 
    //example 
    string s = Search.ReadSearch("this","here",2); //add namespace and references needed 
} 

Why do ASP.NET AJAX page methods have to be static?

+0

メソッドを静的にすることに問題はありますか? –

+0

リンクの更新を参照してください。 –

関連する問題