471,594 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Reflection

Hola a todos!

Estoy intentando ejecutar un método usando Reflection.
El código es el siguiente:

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: No se puede encontrar el método 'SoapExceptionSample.DefaultMasterPage.Mensaje

assemblyType.InvokeMember("Detalles",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.SetProperty,
null,
genericInstance,
args); //<---- Error: No se puede encontrar el método 'SoapExceptionSample.DefaultMasterPage.Detalles

assemblyType.InvokeMember("MostraError",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.InvokeMethod,
null,
genericInstance,
args); //<---- Error: No se puede encontrar el método 'SoapExceptionSample.DefaultMasterPage.MostrarErro r

}
catch (Exception ex) { }

}

Sin embargo, obtengo un error al intentar hacer un InvokeMember en la primera instrucción

No se puede encontrar el método 'SoapExceptionSample.DefaultMasterPage.Mensaje
Estoy utilizando ASP.NET 2.0, la idea es ejecutar un método que se encuentra en una MasterPage desde otro ensamblado.
Mensajey Detallescorresponden a propiedades que se encuentran en la masterpage y MostraError() corresponde al método que deseo ejecutar.

¿Alguna idea?

Saludos cordiales,
Gustavo

Sep 24 '08 #1
0 1573

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by A. Wiebenga | last post: by
9 posts views Thread by Kuberan Naganathan | last post: by
17 posts views Thread by raylopez99 | last post: by
reply views Thread by Gustavo Arriola | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.