1,105,578 Community Members

VB Web Service - how to handle sessions?

Member Avatar
selman555
Newbie Poster
4 posts since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi all,

I have question about sessions in web services (VB).
I created a function that allows me to login to my web service. I created a session here and added some values I retrieved from a stored procedure.

The code will explain more :)

<WebMethod(EnableSession:=True)> _
    Public Function GebruikerLoginWeb(ByVal strGebr As String, ByVal strWachtw As String) As Boolean
        Try
            Dim fm As New Methods_Functions()
            Dim dsLBPHL As DataSet
            dsLBPHL = fm.GebruikerLogin(strGebr, strWachtw)
            If dsLBPHL.Tables.Count > 0 Then
                boolStatus = True
                Session("Gebruikersnaam") = dsLBPHL.Tables(0).Rows(0)(0).ToString
                dsTemp = fm.GebruikerSelecteerAlle(Session("Gebruikersnaam").ToString)
                Session("Wachtwoord") = dsTemp.Tables(0).Rows(0)(1).ToString
                Session("Voornaam") = dsTemp.Tables(0).Rows(0)(2).ToString
                Session("Achternaam") = dsTemp.Tables(0).Rows(0)(3).ToString
                Session("Adres") = dsTemp.Tables(0).Rows(0)(4).ToString
                Session("Gemeente") = dsTemp.Tables(0).Rows(0)(5).ToString
                Session("Email") = dsTemp.Tables(0).Rows(0)(6).ToString
                Session("Geactiveerd") = dsTemp.Tables(0).Rows(0)(7).ToString
                Session("Admin") = dsTemp.Tables(0).Rows(0)(8).ToString
            Else
                boolStatus = False
            End If
            Return boolStatus
        Catch ex As Exception
            objLoggingService.WriteLine(strAppName, ex.Message)
            Throw (ex)
        End Try
    End Function

As you can see, I filled the session with values.
My question is: I have a default.aspx and a master page, how can I redirect the user when their session is active? For example, the default page tells users that access is forbidden untill the login/register.

Do I have to use the form load handler for default.aspx or the masterpages' load handler? How do I check weither the usersession is active?

Question Self-Answered as of 2 Years Ago
Member Avatar
thines01
Postaholic
2,420 posts since Oct 2009
Reputation Points: 389 [?]
Q&As Helped to Solve: 413 [?]
Skill Endorsements: 10 [?]
Team Colleague
Featured
 
0
 

Can you show/tell your solution so others can see it?

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: