System.Web.SessionState.HttpSessionState.this[string].get未将对象引用设置到对象的实例(已请了qq群的老师解决了,学习没有接近路,必须打好坚实)

在使用Visual Studio 2017测试一个聊天小程序时,遇到错误:未将对象引用设置到对象的实例。通过老师的帮助,问题已解决,主要涉及Session和Application的使用。修复方法包括检查Session和Application对象是否正确初始化,并在IIS中添加网站并重启。博客提供了出错和修复后的代码示例。
摘要由CSDN通过智能技术生成

https://www.yljianzhan.com/安装了个聊天小程序,用visual studio 2017测试运行后,显示错误:

未将对象引用设置到对象的实例。

本人初学,什么语法也不懂!! 谁要这些小网站程序块,联系我!qq:466074134 

原主页聊天代码:(https://yljianzhan.com,

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.SessionState;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        int P_int_current = Convert.ToInt32(Application["current"]);
        Application.Lock();
        if (P_int_current == 0 || P_int_current > 20)
        {
            P_int_current = 0;
            Application["chats"] = Session["userName"].ToString() + "说:" + txtMessage.Text.Trim() + "(" + DateTime

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值