asp.net mvc中的会话状态

时间:2009-09-19 03:35:05

标签: asp.net-mvc session

我想知道如何在一个简单的日志中使用会话状态登出asp.net mvc ..

我的控制器中有一个代码,我已从我的mysql数据库中检索到我的会话登录...但我真的不知道如何操作它..

<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

谢谢!

1 个答案:

答案 0 :(得分:0)