I would like to know how to use session state in a simple log in log out in asp.net mvc..
I have a code here in my controller that I've retrieved from my mysql database for my session log in..but I don't really know how to manipulate it..
<AcceptVerbs(HttpVerbs.Post)> _
Function Index(ByVal username As String, ByVal password As String, ByVal department As String) As ActionResult
Dim user As DataTable
user = Account.userSelect(username:=username, password:=password, department:=department)
If user.Rows.Count = 0 Then
Return RedirectToAction("Index", "Home")
Else
Session("username") = user.Rows(0).Item("username")
Session("department") = user.Rows(0).Item("department")
Return RedirectToAction("News", "Administration")
End If
End Function
Thank you!