Reflection

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top