asp.net中在一般处理程序中使用session
2012-08-31 10:53
746 查看
using System; using System.Collections.Generic; using System.Linq; using System.Web; using BLL; using Model; using System.Web.SessionState; using System.Text; namespace Exam { /// <summary> /// Login 的摘要说明 /// </summary> public class Login : IHttpHandler,IRequiresSessionState { public void ProcessRequest(HttpContext context) { string param = context.Request.Form["param"]; if (param.Equals("login")) { string name = context.Request.Form["name"]; string pwd = context.Request.Form["pwd"]; UserInfo model = UserBLL.Login(name, pwd); if (model != null) { context.Session.Add("user", model); context.Response.Write("1"); } else { context.Response.Write("0"); } context.Response.End(); } else if (param.Equals("exit")) { context.Session.RemoveAll(); } else if (param.Equals("userRole")) { int userId=int.Parse(context.Request.Form["user"]); int roleId=int.Parse(context.Request.Form["role"]); UserBLL.UpdateUserRole(userId,roleId); } else if (param.Equals("rightUpdate")) { int roleId =int.Parse(context.Request.Form["roleId"]); string str = context.Request.Form["strList"]; str=str.Substring(0, str.Length - 1); RightBLL.UpdateRoleRight(roleId, str); } else if (param.Equals("getRight")) { int roleId = int.Parse(context.Request.Form["roleId"]); List<RightInfo> list=RightBLL.GetRightIdByRoleId(roleId); StringBuilder sb = new StringBuilder(); foreach (RightInfo item in list) { sb.Append(item.Id+","); } string rights=sb.ToString().Substring(0,sb.Length-1); context.Response.Write(rights); } } public bool IsReusable { get { return false; } } } }
相关文章推荐
- asp.net 中一般应用处理程序使用session
- ASP.NET中在一般处理程序中使用session的简单介绍
- asp.net一般处理程序中使用session
- ASP.NET中在一般处理程序中使用session的简单介绍
- ASP.NET一般处理程序(.ashx.cs)中使用Session的问题
- ASP.NET中在一般处理程序中使用session的简单介绍
- asp.net .ashx一般处理程序中使用Session
- ASP.NET中在一般处理程序中如何使用session
- ASP.NET中在一般处理程序中使用session的简单介绍
- ASP.NET使用一般处理程序生成验证码
- ASP.NET的ASHX一般处理程序中Session为null且不能赋值
- ASP.NET图片防盗链(使用一般处理程序)
- ASP.NET的ASHX一般处理程序中Session为null且不能赋值
- ASP.NET的ASHX一般处理程序中Session为null且不能赋值
- 使用ASP.NET一般处理程序或WebService返回JSON的实现代码
- Asp.net 一般处理程序.ashx中对Session的操作
- 【asp】一般处理程序中使用Session
- ASP.NET的ASHX一般处理程序中Session为null且不能赋值
- asp.net中一般处理程序和普通类文件使用HttpContext对象
- 使用 ASP.NET 一般处理程序或 WebService 返回 JSON