asp and global variables

  • Thread starter Thread starter starbuck
  • Start date Start date
S

starbuck

Hi

My first vb.net/asp.net application is taking shape now and I have started
using session state to store user variables or type string, long and bool..
The VB6 app I am converting also makes great use of global variables as per
the example below

Structure Gen_setup

Dim Nominal As Long

Dim TaxCode As Integer

Dim VATNo As String



End Structure

Public setups As Gen_setup

I want to convert this to session state, can anyone show me the best way.

Thanks in advance.
 
I think this is what you are after.

public structure Gen_setup
Dim Nominal As Long
Dim TaxCode As Integer
Dim VATNo As String
Public Sub New(pNominal as long, pTaxCode as Integer, pVATNo as String)
Me.Nominal = pNominal
Me.TaxCode = pTaxCode
Me.VATNo = pVATNo
End Sub
end structure


Session["mySessionVar"] = new Gen_setup(21,6,"some string here")
 
You may want to add this attribute in case you ever use out of process session state (StateServer).
Then you classes and structures need to be serializable. May as well build it in up front.

<Serializable>_
public structure Gen_setup

--
Joe Fallon




I think this is what you are after.

public structure Gen_setup
Dim Nominal As Long
Dim TaxCode As Integer
Dim VATNo As String
Public Sub New(pNominal as long, pTaxCode as Integer, pVATNo as String)
Me.Nominal = pNominal
Me.TaxCode = pTaxCode
Me.VATNo = pVATNo
End Sub
end structure


Session["mySessionVar"] = new Gen_setup(21,6,"some string here")
 
Back
Top