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?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.