在组件类中使用Session、Application、Response
2009-04-24 10:12
555 查看
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";
}
我知道在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";
}
相关文章推荐
- 第十五节:HttpContext五大核心对象的使用(Request、Response、Application、Server、Session)
- 编写一个JSP文件,使用pageContext内置对象来获取由session、request和application内置对象设置的属性。
- 避免在Application或Session对象中缓存非轻快型组件
- 对于不支持cookie的浏览器,使用response.encodeURL方法来使用session
- request,response,session,cookie,application【转】
- page,request,session,application四个域对象的使用及区别
- page,request,session,application四个域对象的使用及区别1
- request,response,session,application四者之间的作用域联系以及各自的运行机制
- 【转】关于如何在类库中使用Response,Request,Server,Session!
- 如何在Webservice里面使用Session和Application
- 【转】关于如何在类库中使用Response,Request,Server,Session!
- page,request,session,application四个域对象的使用及区别
- session cookies application ispostback request response
- Restlet - 使用Restlet自身组件Application/Component的开发实例
- ASP.NET中在自定义类中使用Session,Request,Response,Server
- JSP九大内置对象---Request,Response,Out,Session,Application,Cookie,Config,Page,Exception
- @SessionAttributes与@ResponseBody同时使用的问题
- ASP.NET中在自定义类中使用Session,Request,Response,Server
- 五大对象response 、request 、session、 application、 serve
- equest,response,session,cookie,application