私は今、common.csという名前のWebサービスを持っている例でこの答えを与えています
public class Common : System.Web.Services.WebService
{
public Common ()
{
//here you can check your session so when ever your
webmethod will be executed this code will call first then your webmethod
}
//this webmethod will be executed after common
[WebMethod]
public static bool WebMethodCall()
{// check if its a logged in user or not before executing the webmethod
return true;
}
[WebMethod]
public static bool WebMethodCall1()
{// check if its a logged in user or not before executing the webmethod
return true;
}
}
したがって、説明は次のようになります。common という名前の共通クラスがあり、2 つの webmethod webmethodcallとwebmethodcall1
が共通のコードを共通
に追加します。