怎样调用app_code里的cs类!!!!!!!!!
CS类如下:
/**//// <summary>
/// FilterRealProxy类:一个真实代理, 拦截它所代理对象中方法的返回值,并对需要过滤的返回值进行过滤。
/// </summary>
public class FilterRealProxy:RealProxy
{
private MarshalByRefObject target;
public FilterRealProxy(MarshalByRefObject target):base(target.GetType())
{
this.target=target;
}
public override IMessage Invoke(IMessage msg)
{
IMethodCallMessage callMsg=msg as IMethodCallMessage;
IMethodReturnMessage returnMsg = RemotingServices.ExecuteMessage(target,callMsg);
//检查返回值是否为String,如果不是String,就没必要进行过滤
if(this.IsMatchType(returnMsg.ReturnValue))
{
string returnValue=this.Filter(returnMsg.ReturnValue.ToString(),returnMsg.MethodName);
return new ReturnMessage(returnValue,null,0,null,callMsg);
}
return returnMsg;
}
protected string Filter(string ReturnValue,string MethodName)
{
MethodInfo methodInfo=target.GetType().GetMethod(MethodName);
object[] attributes=methodInfo.GetCustomAttributes(typeof(StringFilter),true);
foreach (object attrib in attributes)
{
return FilterHandler.Process(((StringFilter)attrib).FilterType,ReturnValue);
}
return ReturnValue;
}
protected bool IsMatchType(object obj)
{
return obj is System.String;
}
}
/**//// <summary>
/// StringFilter类:自定义属性类, 定义目标元素的过滤类型
/// </summary>
public class StringFilter:Attribute
{
protected FilterType _filterType;
public StringFilter(FilterType filterType)
{
this._filterType=filterType;
}
public FilterType FilterType
{
get
{
return _filterType;
}
}
}
/**//// <summary>
/// 枚举类:用于指定过滤类型,例如:对script过滤还是对html进行过滤?
/// </summary>
[Flags()]
public enum FilterType
{
Script = 1,
Html =2,
Object=3,
AHrefScript=4,
Iframe=5,
Frameset=6,
Src=7,
BadWords=8,
//Include=9,