Accessing Application / response from userclass!

Results 1 to 2 of 2

Thread: Accessing Application / response from userclass!

  1. #1
    Join Date
    Dec 1969

    Default Accessing Application / response from userclass!

    I have posted a similar question before, whiteout getting an answer..<BR>My code looks something like this (userclass.vb)<BR>[code language="VB.Net"]<BR>Public Class Functions<BR> Inherits System.Web.UI.Page<BR><BR> Public Sub PostEvent(ByVal EventTxt as String, Optional ByVal EventId as Integer = 1)<BR> Dim EventArr as ArrayList = Ctype(Application("SC_Msg"), ArrayList) &#039;*<BR> &#039;Do some stuff...<BR> Application("SC_Msg") = EventArr &#039;*<BR> End Sub<BR>End Class<BR>[/code]<BR><BR>Calling the sub like this (default.aspx.vb):<BR>[code language="VB.Net"]<BR> Functions.PostEvent("User Logged Off!") &#039;**<BR>[/code]<BR><BR>In above code I would get an: &#039;Reference to an non-shared member requires object reference&#039; error on **.<BR>If I make the sub shared I get an:<BR>&#039;Can not refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class&#039; error on *.<BR><BR>I have no clue what this means, and more important what I am supposed to do.. Any comment is highly welcome..<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Accessing Application / response from userclas

    Try using:<BR>HttpContext.Current.Application<BR><BR>

Posting Permissions

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