This sample illustrates how to access ASP+ intrinsics, such as the Session and Application objects. It also shows how to turn off Session on a per-[WebMethod] basis.
<p>
The first method in the sample .asmx file, <B>UpdateHitCounter</B> accesses the Session, and adds 1 to the "HitCounter" value. It then returns this value as a String. The second method, <B>UpdateAppCounter</B> does the same thing, but with the Application. Notice the following:
<p>
<div class="code"><pre>
[WebMethod(EnableSession=False)]
</pre></div>
<p>
This turns off Session support, which will speed up this Web Method's performance. Sessions aren't needed for this object, since it only uses the Application object. This compiler directive is recommended in cases where performance is critical.
When the client proxy is accessed, it contains a cookie collection. This collection is used to accept and return the APSESSIONID cookie that ASP+ uses to track Sessions. This is what allows this client to receive varying answers to the Session hit method.