注册 登录
编程论坛 ASP.NET技术论坛

请教ASP页面的application问题

tuzi8612 发布于 2009-07-30 14:03, 656 次点击
实现简单的页面聊天,就是在控件旁边放一个Timer,实现刷新,
但是我想请问一下下,怎么把发送的内容存到Application里去?
把值取出来的时候, 应该怎么取哇?
请大虾指点~~``说说思路也行
1 回复
#2
programlv2009-08-04 11:19
Application["aa"]=bb;
TextBox1.Text=Application["aa"].ToString();
貌似Application不太好做你的那个东西

你加个类吧







class Chat{
 public User who;
 public string SayWhat;
 public DateTime SayTime;
 ....
 public Chat(User w,string sayWhat){
  this.who=w;
  this.sayWhat=sayWhat;
 }


}
class User{
  public string uid;
  private string pwd;
  public string name;
  public string info;
  public DateTime loginTime;
  ...//等等属性
  

public User(string u,string p){
  this.uid=u;
  this.pwd=p;
}
  public User(){

  }
  ...//构造器诺干 看你怎么用了
}

Application["谁的ID"]=new Chat(new User("123","123"),"说话");

TextBox1.Text=((Chat)Application["谁的ID"]).SayWhat;
                                           .你要输出的属性什么的

别抄啊, 手写的   没VS2005  思路而已
1