Click here to Skip to main content
15,920,111 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Hashing fields pre server post Pin
Michael_Cox3-Dec-14 6:38
Michael_Cox3-Dec-14 6:38 
GeneralRe: Hashing fields pre server post Pin
Richard Deeming3-Dec-14 7:41
mveRichard Deeming3-Dec-14 7:41 
GeneralRe: Hashing fields pre server post Pin
Michael_Cox3-Dec-14 9:37
Michael_Cox3-Dec-14 9:37 
GeneralRe: Hashing fields pre server post Pin
Richard Deeming3-Dec-14 10:22
mveRichard Deeming3-Dec-14 10:22 
QuestionPassword recovery tutorial Pin
Member 876166727-Nov-14 4:42
Member 876166727-Nov-14 4:42 
AnswerRe: Password recovery tutorial Pin
ZurdoDev1-Dec-14 7:25
professionalZurdoDev1-Dec-14 7:25 
GeneralRe: Password recovery tutorial Pin
Member 87616676-Dec-14 6:18
Member 87616676-Dec-14 6:18 
Questionall Pin
Member 1123433227-Nov-14 3:24
Member 1123433227-Nov-14 3:24 
SuggestionRe: all Pin
Richard MacCutchan27-Nov-14 3:29
mveRichard MacCutchan27-Nov-14 3:29 
GeneralRe: all Pin
Member 1123433227-Nov-14 3:37
Member 1123433227-Nov-14 3:37 
AnswerRe: all Pin
ZurdoDev1-Dec-14 7:25
professionalZurdoDev1-Dec-14 7:25 
QuestionAdd Dynamically A LinkButton Inside Nested (Child) GridView Pin
Mrkhoza27-Nov-14 2:26
professionalMrkhoza27-Nov-14 2:26 
AnswerRe: Add Dynamically A LinkButton Inside Nested (Child) GridView Pin
jaimin851-Dec-14 23:37
jaimin851-Dec-14 23:37 
QuestionHelp in Converting Desktop App to Web App. Pin
QuickBooksDev26-Nov-14 4:48
QuickBooksDev26-Nov-14 4:48 
AnswerRe: Help in Converting Desktop App to Web App. Pin
jkirkerx26-Nov-14 10:48
professionaljkirkerx26-Nov-14 10:48 
GeneralRe: Help in Converting Desktop App to Web App. Pin
QuickBooksDev27-Nov-14 0:37
QuickBooksDev27-Nov-14 0:37 
GeneralRe: Help in Converting Desktop App to Web App. Pin
Richard Deeming27-Nov-14 3:07
mveRichard Deeming27-Nov-14 3:07 
GeneralRe: Help in Converting Desktop App to Web App. Pin
QuickBooksDev27-Nov-14 9:16
QuickBooksDev27-Nov-14 9:16 
GeneralRe: Help in Converting Desktop App to Web App. Pin
Richard Deeming27-Nov-14 9:19
mveRichard Deeming27-Nov-14 9:19 
GeneralRe: Help in Converting Desktop App to Web App. Pin
QuickBooksDev30-Nov-14 2:53
QuickBooksDev30-Nov-14 2:53 
GeneralRe: Help in Converting Desktop App to Web App. Pin
Richard Deeming1-Dec-14 1:36
mveRichard Deeming1-Dec-14 1:36 
GeneralRe: Help in Converting Desktop App to Web App. Pin
QuickBooksDev2-Dec-14 23:32
QuickBooksDev2-Dec-14 23:32 
GeneralRe: Help in Converting Desktop App to Web App. Pin
Richard Deeming3-Dec-14 1:28
mveRichard Deeming3-Dec-14 1:28 
GeneralRe: Help in Converting Desktop App to Web App. Pin
QuickBooksDev3-Dec-14 1:33
QuickBooksDev3-Dec-14 1:33 
GeneralRe: Help in Converting Desktop App to Web App. Pin
Richard Deeming3-Dec-14 1:49
mveRichard Deeming3-Dec-14 1:49 
Yes, in a web application it will last until the AppPool recycles.

There's no way to make a module non-shared. However, you might be able to get away with changing the field to a property, and adding code to retrieve the value from the current session if the code is running in an ASP.NET application. Something like this should work:
VB.NET
Imports System.Web
Imports System.Web.Hosting

Module Common
    ' The key for the field in the session - this must be unique:
    Private Const SessionKey As String = "Common::aCL"
    
    ' Backing field used for non-web applications:
    Private aCLNonWeb As vbMain.QBAPIV3Cl
    
    Public ReadOnly Property aCL() As vbMain.QBAPIV3Cl
        Get
            If Not HostingEnvironment.IsHosted Then
                ' Not running in ASP.NET:
                If aCLNonWeb Is Nothing Then
                    Set aCLNonWeb = New vbMain.QBAPIV3Cl()
                End If
                
                Return aCLNonWeb
            End If
            
            Dim context As HttpContext = HttpContext.Current
            If context Is Nothing Then
                Throw New InvalidOperationException("No current request.")
            End If
            
            Dim value As vbMain.QBAPIV3Cl = DirectCast(context.Session(SessionKey), vbMain.QBAPIV3Cl)
            If value Is Nothing Then
                value = New vbMain.QBAPIV3Cl()
                context.Session.Add(SessionKey, value)
            End If
            
            Return value
        End Get
    End Property
End Module




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.