This snippet is in my Business Logic Layer Class File:
Public Shared Function getAccIDFromSocialAuthSession() As Object
Dim db As SqlDatabase = Connection.connection
Dim accID As Integer
If SocialAuthUser.IsLoggedIn Then
Using cmd As SqlCommand = db.GetSqlStringCommand("SELECT AccountID FROM UserAccounts WHERE FBID=@fbID")
db.AddInParameter(cmd, "fbID", SqlDbType.VarChar, SocialAuthUser.GetCurrentUser.GetProfile.ID)
accID = db.ExecuteScalar(cmd)
End Using
End If
Return accID
End Function
I am using SocialAuth.Net. SocialAuth.NET
stores everything in session. For e.g to get the Facebook User ID we call SocialAuthUser.GetCurrentUser.GetProfile.ID
, since it is session based i get this error message "Object Reference Not Set to an instance of an object" when i try to call SocialAuthUser.GetCurrentUser.GetProfile.ID
from a webservice (asmx.vb) file. I am calling it like this (ClassName.FunctionName-->BLL.getAccIDFromSocialAuthSession)
Whaen i call the same function from a aspx.vb
page it works fine but not when i call it from an asmx.vb
page.
Since i do not know the session variable name , i cannot use System.Web.HttpContext.Current.Session("NameHere")
Any solution??