Reflection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gustavo Arriola

    Reflection

    Hello everybody!

    I'm trying to execute a method using Reflection.
    The code is as follows:

    public static void SoapHandler(Exc eption Error) {
    try
    {

    Type assemblyType;
    object genericInstance ;
    assemblyType = BuscarClaseEnAs sembly("SoapExc eptionSample", "DefaultMasterP age");
    object[] args = new object[] { Error.Message, Error.Message.T oString() };
    //Creamos la instancia
    genericInstance = Activator.Creat eInstance(assem blyType);


    assemblyType.In vokeMember("Men saje",
    System.Reflecti on.BindingFlags .Instance | System.Reflecti on.BindingFlags .Public |
    System.Reflecti on.BindingFlags .SetProperty,
    null,
    genericInstance ,
    args); //<---- Error: Unable to find a method 'SoapExceptionS ample.DefaultMa sterPage.Mensaj e

    assemblyType.In vokeMember("Det alles",
    System.Reflecti on.BindingFlags .Instance | System.Reflecti on.BindingFlags .Public |
    System.Reflecti on.BindingFlags .SetProperty,
    null,
    genericInstance ,
    args); //<---- Error: Unable to find a method 'SoapExceptionS ample.DefaultMa sterPage.Detall es

    assemblyType.In vokeMember("Mos traError",
    System.Reflecti on.BindingFlags .Instance | System.Reflecti on.BindingFlags .Public |
    System.Reflecti on.BindingFlags .InvokeMethod,
    null,
    genericInstance ,
    args); //<---- Error: Unable to find a method 'SoapExceptionS ample.DefaultMa sterPage.Mostra rError

    }
    catch (Exception ex) { }

    }

    However, I get an error trying to do in a InvokeMember
    first instruction

    Unable to find a method 'SoapExceptionS ample.DefaultMa sterPage.Mensaj e


    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





Working...