IAjaxProcessor.cs
上传用户:szgaoree
上传日期:2009-01-05
资源大小:74k
文件大小:2k
- using System;
- using System.Web;
- using System.Reflection;
- namespace AjaxPro
- {
- public abstract class IAjaxProcessor
- {
- protected HttpContext context;
- protected Type type;
- protected MethodInfo method;
- public IAjaxProcessor(HttpContext context, Type type)
- {
- this.context = context;
- this.type = type;
- }
- #region Internal Properties
- internal bool CanHandleRequest
- {
- get
- {
- return Method != null;
- }
- }
- internal HttpContext Context
- {
- get
- {
- return context;
- }
- }
- internal Type Type
- {
- get
- {
- return type;
- }
- }
- #endregion
- #region Virtual Members
- public virtual bool IsValidAjaxToken(string serverToken)
- {
- if(Utility.Settings == null || !Utility.Settings.TokenEnabled)
- return true;
- if(System.Web.HttpContext.Current == null || System.Web.HttpContext.Current.Request == null)
- return false;
- string token = System.Web.HttpContext.Current.Request.Headers["Ajax-token"];
- if(serverToken != null && token == serverToken)
- return true;
- return false;
- }
- public virtual object[] RetreiveParameters()
- {
- return null;
- }
- public override int GetHashCode()
- {
- throw new NotImplementedException();
- }
- public virtual string SerializeObject(object o)
- {
- return "";
- }
- public virtual bool IsEncryptionAble
- {
- get
- {
- return false;
- }
- }
- public virtual MethodInfo Method
- {
- get
- {
- throw new NotImplementedException();
- }
- }
- #endregion
- }
- }