using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Demo
{
/// <summary>
/// Login 的摘要说明
/// </summary>
public class Login : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/html";
string name = context.Request["name"];
string password = context.Request["pwd"];
string html = "<html><head></head><body><form action='Login.ashx'>name<input type='text' name='name' value='{name}'/><br/>password<input type='text' name='pwd' value='{password}'/><input type='submit' value='Login'/></form><p>{msg}</p></body></html>";
if (String.IsNullOrEmpty(name) && string.IsNullOrEmpty(password))
{
context.Response.Write("<html>");
String code = html.Replace("{name}", "");
code = code.Replace("{password}", "");
code = code.Replace("{msg}", "");
context.Response.Write(code);
}
else
{
if (name == "guanlin" && password == "123")
{
context.Response.Write("<html>");
String code = html.Replace("{name}", name);
code = code.Replace("{password}", password);
code = code.Replace("{msg}", "success");
context.Response.Write(code);
}
else
{
context.Response.Write("<html>");
String code = html.Replace("{name}", name);
code = code.Replace("{password}", password);
code = code.Replace("{msg}", "false");
context.Response.Write(code);
}
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
登录(C#)
最新推荐文章于 2024-03-31 10:26:44 发布