Murray Brown
asked on
ASP.net VB.net Using the variable for an API elsewhere on the page
Hi
I am using the following VB.net code to connect to the Xero API in my web page. I also want to be use the "myxeroapi" variable on a button click
on the page. Do I use session variables? If so what would the code look like?
I am using the following VB.net code to connect to the Xero API in my web page. I also want to be use the "myxeroapi" variable on a button click
on the page. Do I use session variables? If so what would the code look like?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myxeroapi As XeroCoreApi
If IsPostBack = False Then
'SO PAGE LOADS TWICE
If Request.QueryString("oauth_verifier") Is Nothing Then
'FIRST LOAD ALLOWS YOU TO AUTH IN
myxeroapi = XeroAuthenticate(Me, False, "")
Else
'SECOND LOAD LET'S YOU DO SOMETHING
myxeroapi = XeroAuthenticate(Me, True, "")
If Not myxeroapi Is Nothing Then
Dim i As Integer = myxeroapi.Contacts.Find.Count 'Quick Test
Call oCreateInvoice(myxeroapi)
End If
End If
End If
End Sub
ASKER
I want someone to first log in and then with other buttons etc on the page do certain things
ASKER
I really just want to know how to access the myxeroapi variable in another procedure
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
second, why you are concern about the session variable here? do you need someone to logged in before the calling or you wish to pass session variable to xero api?