Results 1 to 3 of 3

Thread: how to declare an object to make it dispoible in the whole session ?

  1. #1

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Question how to declare an object to make it dispoible in the whole session ?

    Is it possible to declare an object (myObject) in a way that makes it dispoible for a whole session, without being forced to declare it in each object where I want to use myObject like this:

    Public myObject As myClass = HttpContext.Current.Session("myObject ")

    Thank you very much for any advice!

    Fabian

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: how to declare an object to make it dispoible in the whole session ?

    No.

    You can however use a public static method
    VB Code:
    1. Public Sealed Class MyObject
    2.   Public Static Function GetObject(context As HttpContext)
    3. {
    4.  Return (MyObject)context.current.Session["myobject"];
    5. }
    6.  
    7.  'the rest of your object class
    8. End Class

  3. #3

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Re: how to declare an object to make it dispoible in the whole session ?

    Thank you very much for your help !

    By the way ... as you are a certifed one - could you help me with this other problem - probebaly very simple for you, but not for me :-( because I do not know the adequate termonology to search for it... :

    http://www.vbforums.com/showthread.php?t=340660
    (my first post is a bit confused, better read the second one)
    Last edited by fabianus; May 24th, 2005 at 07:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width