The situation is as follows. I have an asp.net webservice application ... let's say the api.asmx page
In the code behind, I have several methods, for example:
[WebMethod(Description="Method1")]
public int GetSomething(int num1, int num2){
try{
return SomeObject.DatabaseCall.DoSomething(num1, num2);
}
catch(Exception ex){
object[] pars = new object[] { num1, num2 };
LogError("GetSomething", pars, ex);
}
}
[WebMethod(Description="Method2")]
public int GetSomething2(string w, string j, int f){
try{
return AnotherObject.DoSomething(w, j, f);
}
catch(Exception ex){
object[] pars = new object[] { w, j, f };
LogError("GetSomething2", pars, ex);
}
}
Of course, these are just two simple examples, where, if an exception is thrown, I can register the method call and the parameters passed.
Is there any other way to do this? Is there a way I can extract the called method and / or parameters. I guess I hope someone tells me that I can just have some kind of function like:
LogError(ex);
Server Environment, . , - CurrentContext.WebServiceCall.Magic... try/catch, .
, .
Brian