Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Sessions in App_Code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Sessions in App_Code

 Post Reply Post Reply
Author
VBScript View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2004
Location: United Kingdom
Status: Offline
Points: 219
Post Options Post Options   Thanks (0) Thanks(0)   Quote VBScript Quote  Post ReplyReply Direct Link To This Post Topic: Sessions in App_Code
    Posted: 13 June 2008 at 11:05am
Does anyone know how to access sessions  from a function which is in a module in the App_Code folder?
Back to Top
VBScript View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2004
Location: United Kingdom
Status: Offline
Points: 219
Post Options Post Options   Thanks (0) Thanks(0)   Quote VBScript Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2008 at 11:13am
I've found a solution to my own problem

In a module at the following namespace
Imports System.Web.SessionState

Add the following public variable
Public Session As HttpSessionState = HttpContext.Current.Session


You can now use sessions normally

'Set method
Session("var1") = "Hello World")

'Get method
strText = Session("var1")


Back to Top
Videoediting View Drop Down
Newbie
Newbie
Avatar

Joined: 30 July 2008
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Videoediting Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2008 at 12:43pm
Set the value
System.Web.HttpContext.Current.Session["Key"] =value;

Get the value
value=System.Web.HttpContext.Current.Session["Key"].tostring():

Hope this helps!!!

Cheers,

SPBig%20smile
http://www.videoediting-direct.co.uk
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.