I have problem, I want set soap extension attribute in web method: Soap extension in web service:
public class EncryptMessageAttribute : SoapExtensionAttribute
{
private string strKey="null";
public void setKey(string s)
{
strKey=s;
}
}
Soap extension class:
public class EncryptMessage : SoapExtension
{
....
}
Soap extension on web method:
public class Service1 : System.Web.Services.WebService
{
public string k;
[WebMethod]
[EncryptMessageAttribute(setKey(k))]
public string test2()
{
return "ok";
}
[WebMethod]
[EncryptMessage(setKey(k))]
public string test2()
{
return "ok";
}
}
It finish with this compile error:
Error 1 The name 'setKey' does not exist in the current context Error 2 An object reference is required for the non-static field, method, or property