Accepted answer

i found it. i was traing to compile the application using .net framework 4 client profile.

if you use the complete version of .net framework (go to project properties / application / target framework and set to .net framework 4, don't use client profile) you are able to compile windows application using system.web dll's.

if you want do know if you are running a library in an windows application or a web application and want to know if it is possible to use session, do

public virtual bool isweb()
    return (system.web.httpcontext.current != null);

public virtual bool issessionenabled()
    return isweb() && (system.web.httpcontext.current.session != null)


you can build a class library which contains you need to do references,then public them to gac. then you can both use them in others .net application solution easyly.

Related Query

More Query from same tag