using Microsoft.Owin;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Api.Framework.Events
{
///
/// web请求事件
///
public class WebRequestEvents : BaseEvents
{
///
/// 响应结果
///
private WebClient.Result Respose { get; set; }
///
/// 发送错误请求
///
/// 异常
/// 错误代码
public void Send(Exception e, int code = -1)
{
Send(e.Message, code);
}
///
/// 发送正确请求
///
/// 请求内容
/// 正确代码
public void Send(object message, int code = 0)
{
Respose.Message = message;
Respose.Code = code;
this.Cancel = true;
}
///
/// 提交的参数 包含:GET POST 合集
///
public Dictionary Param { get; private set; }
///
/// 上下文
///
public IOwinContext Context { get; private set; }
///
/// cookies
///
public NameValueCollection Cookies { get; private set; }
///
/// 构造方法
///
/// 上下文
/// 提交的参数 包含:GET POST 合集
/// 响应的对象
public WebRequestEvents(IOwinContext context, Dictionary Param, WebClient.Result Respose)
{
this.Context = context;
this.Param = Param;
this.Respose = Respose;
}
}
}