KnowDotNet Visual Organizer

Net Sessions - Manage ASP.NET Session Variables

Using Consts for Session Variables

Possibly the easiest method of maintaining Session Variables is through the use of Consts. To use this method, it is recommend that you create a Module in VB.NET or a Class with Static Consts in C#. Figure 1 shows how you can have Intellisense when typing a Session Variable in C#. The illustration is in a non-aspx .cs file for illustration purposes only. You cannot access a Session Variable in this type of file. This was done on purpose to illustrate the creation of the Const Session Variable and Intellisense when accessing the variable.   Net Sessions is available for purchase or Free 30 Day Trial.  Click here to download.


Figure 1 - Using Const for Session Variable.

Const Intellisense


As with any method, you can still use the dockabel Tool Window to paste a session variable into your code window at the cursor position.  See the description of the Tool Window on the Main Net Sessions Product Page.



Writing Add-Ins for Visual Studio .NET
Writing Add-ins for Visual Studio .NET
by Les Smith
Apress Publishing