Session state in asp.net mvc

Posted by tiff on Stack Overflow See other posts from Stack Overflow or by tiff
Published on 2009-09-19T03:35:05Z Indexed on 2010/04/07 15:03 UTC
Read the original article Hit count: 534

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about session

Related posts about asp.net-mvc