首页 > Windows开发 > 详细

C# ashx后台处理session错误

时间:2016-01-05 12:28:26      阅读:340      评论:0      收藏:0      [点我收藏+]
using DAL;
using Models;
using System.Web.SessionState;

namespace cleaner.ashx
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class UserLogin : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string str = "false";

            if (context.Session["Username"] != null)
            {
                context.Response.Redirect("backindex.aspx");
                context.Response.End();
            }

            string username = context.Request["username"];//接收账号

            if (!string.IsNullOrEmpty(username))
            {
                string pwd = context.Request["pwd"];//接收密码
                if (!string.IsNullOrEmpty(pwd))
                {
                    str = CheckNamePwd(username, pwd);
                }
            }
            context.Response.Write(str);
        }

 

C# ashx后台处理session错误

原文:http://www.cnblogs.com/demoC/p/5101750.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!