Session State Context in ASP.Net


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Session State Context in ASP.Net

  1. #1
    Alan Tong Guest

    Session State Context in ASP.Net


    I have done the following in my VB.Net class supporting my ASP.Net application
    but got a "Object Reference not set to an instance of an object" error, I
    thought I had set it to the current instance of the Context object?! Please
    help!

    Thanks
    Alan...

    Imports System.Web

    Public Class User

    Dim objContext As HttpContext = HttpContext.Current

    Dim intAppID As Integer = objContext.Application("App_ID")
    Dim strSessionID As String = objContext.Session.SessionID

    End Class

  2. #2
    zack Guest

    Re: Session State Context in ASP.Net


    Alan,

    Public Class User
    'Try this!
    Dim objContext As new HttpContext.Current

    Dim intAppID As Integer = objContext.Application("App_ID")
    Dim strSessionID As String = objContext.Session.SessionID

    End Class


  3. #3
    Alan Tong Guest

    Re: Session State Context in ASP.Net


    Thanks. But it didn't work...

    Alan...

    "zack" <zack_attack190@yahoo.com> wrote:
    >
    >Alan,
    >
    >Public Class User
    > 'Try this!
    > Dim objContext As new HttpContext.Current
    >
    > Dim intAppID As Integer = objContext.Application("App_ID")
    > Dim strSessionID As String = objContext.Session.SessionID
    >
    >End Class
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center