G
Gustavo Arriola
Hello everybody!
I'm trying to execute a method using Reflection.
The code is as follows:
public static void SoapHandler(Exception Error) {
try
{
Type assemblyType;
object genericInstance;
assemblyType = BuscarClaseEnAssembly("SoapExceptionSample", "DefaultMasterPage");
object[] args = new object[] { Error.Message, Error.Message.ToString() };
//Creamos la instancia
genericInstance = Activator.CreateInstance(assemblyType);
assemblyType.InvokeMember("Mensaje",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetProperty,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Mensaje
assemblyType.InvokeMember("Detalles",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetProperty,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Detalles
assemblyType.InvokeMember("MostraError",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.InvokeMethod,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.MostrarError
}
catch (Exception ex) { }
}
However, I get an error trying to do in a InvokeMember
first instruction
Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Mensaje
I am using ASP.NET 2.0, the idea is to run a method that is
in a MasterPage from another assembly.
Mensaje and Detalles are properties that are in the masterpage and MostraError () method that corresponds to the desire to run.
Any idea?
Best regards,
Gustavo
I'm trying to execute a method using Reflection.
The code is as follows:
public static void SoapHandler(Exception Error) {
try
{
Type assemblyType;
object genericInstance;
assemblyType = BuscarClaseEnAssembly("SoapExceptionSample", "DefaultMasterPage");
object[] args = new object[] { Error.Message, Error.Message.ToString() };
//Creamos la instancia
genericInstance = Activator.CreateInstance(assemblyType);
assemblyType.InvokeMember("Mensaje",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetProperty,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Mensaje
assemblyType.InvokeMember("Detalles",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetProperty,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Detalles
assemblyType.InvokeMember("MostraError",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.InvokeMethod,
null,
genericInstance,
args); //<---- Error: Unable to find a method 'SoapExceptionSample.DefaultMasterPage.MostrarError
}
catch (Exception ex) { }
}
However, I get an error trying to do in a InvokeMember
first instruction
Unable to find a method 'SoapExceptionSample.DefaultMasterPage.Mensaje
I am using ASP.NET 2.0, the idea is to run a method that is
in a MasterPage from another assembly.
Mensaje and Detalles are properties that are in the masterpage and MostraError () method that corresponds to the desire to run.
Any idea?
Best regards,
Gustavo