在一个程序中有一个PEContex类,这个类是获取一些网站和用户的通用信息的,有一个
/// <summary>
/// Http请求上下文
/// </summary>
public HttpContext Context
{
get
{
return httpContext;
}
}
的属性,
我想在另一个程序中通过反射获取该属性.
Assembly asm = Assembly.LoadFile(HttpContext.Current.Server.MapPath("~/bin/Components.dll"));
Type objType = asm.GetType("Components.PEContext");
HttpContext con = (HttpContext)objType.InvokeMember("Context", BindingFlags.Instance | BindingFlags.Static | BindingFlags.GetProperty, null, null, null);但总是报找不到Context属性的错误````郁闷通过PropertyInfo[] myproperties = objType.GetProperties();
this.Show(myproperties);
public void Show(object[] os)
{
foreach (object var in os)
{
var.ToString();
}
}
又显示出有Context.
还请大虾多指点,小弟先谢了.
/// <summary>
/// Http请求上下文
/// </summary>
public HttpContext Context
{
get
{
return httpContext;
}
}
的属性,
我想在另一个程序中通过反射获取该属性.
Assembly asm = Assembly.LoadFile(HttpContext.Current.Server.MapPath("~/bin/Components.dll"));
Type objType = asm.GetType("Components.PEContext");
HttpContext con = (HttpContext)objType.InvokeMember("Context", BindingFlags.Instance | BindingFlags.Static | BindingFlags.GetProperty, null, null, null);但总是报找不到Context属性的错误````郁闷通过PropertyInfo[] myproperties = objType.GetProperties();
this.Show(myproperties);
public void Show(object[] os)
{
foreach (object var in os)
{
var.ToString();
}
}
又显示出有Context.
还请大虾多指点,小弟先谢了.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货