using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using Itlead.Architecture.Contract;
using Itlead.Architecture.Contract.DataContract;
namespace Itlead.Architecture.WebAppUI.tools
{
///
/// CheckUser 的摘要说明
///
public class CheckUser : IHttpHandler
{
const string userService = "userService";
public void ProcessRequest(HttpContext context)
{
// context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
String callbackName = "success_jsonpCallback";
context.Response.AddHeader("Access-Control-Allow-Origin", "*");
context.Response.Expires = 0;
context.Response.CacheControl = "no-cache";
context.Response.AddHeader("Pragma", "No-Cache");
context.Response.ContentType = "application/json";
string username = context.Request.Params["username"];
var s = MyBasicLib.Utilities.ServiceInvoker.Invoke(userService, u => u.ExitsUser(username));
if (s == false)
{
string message = "{\"message\":\"no\"}";
context.Response.Write(callbackName + "(" + message + ")");
}
else
{
string message = "{\"message\":\"yes\"}";
context.Response.Write(callbackName + "(" + message + ")");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}