Q:

  我知道在asp中用VB编写组件时,是可以使用Session、Application、Response等的,  
  那么在asp.net中用C#编写组件,如何才能使用网站中生成的Session、Application呢?如何才能使用Response直接输入出呢?请大家指教...

 

A:

需要你先定义  
  public     System.Web.SessionState.HttpSessionState   Session;  
  public     System.Web.HttpResponse   Response;  
  public     System.Web.HttpServerUtility   Server;  
  public     System.Web.HttpRequest   Request;  
  然后在用  
  System.Web.SessionState.HttpSessionState   mys=HttpContext.Current.Session;  
  if(mys["SessionID"]==null||mys["SessionID"].ToString().Length==0)  
  {  
  return   "1";  
  }  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-11-23
  • 2021-09-17
猜你喜欢
  • 2022-12-23
  • 2021-08-09
  • 2021-05-29
  • 2021-10-09
  • 2021-12-23
相关资源
相似解决方案