当前位置:编程学习 > C#/ASP.NET >>

ASP.NET中为什么我的Session状态写不进值?我的详细代码如下

            context.Response.ContentType = "text/plain";
            try
            {
                if (context.Request.QueryString["userID"] == "12345" && context.Request.QueryString["password"] == "12345")
                {
                    context.Session.Add("logined", "true");//为什么程序一运行到这里就自动出错了
                    context.Response.Write("Hello World");
                    return;
                }
                if (context.Session["logined"].ToString() == "true")
                {
                    context.Response.Write("Hello World");
                }
            }
            catch
            {
                context.Response.Write("请先登录");
            }
追问:一样的,没有用,早就试过了。忘记说我的,上面的代码我是写在一般处理程序中的,并且是在客户端用AJAX调用,不知这样会不会有什么影响

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,