I am having a problem I can not find a tutorial or some code where I am able to do some session state. For example I would like to create a application where when a user logs in, he or she can only view there information for example a student viewing his grades an no other student can see that information. I have achieved this in VB 2008 last year but need help in MVC3 as it is not the same as the language as i am using C#. In vb 2008 i achieved this connecting a table from the ASP.net database (users) and joined to my employee table by a foreign key. And added the following code:
Session("ID") = objUser
Dim db As New DataClassesDataContext
Dim info = From a In db.tblCourses _
Where a.CourseTitle = ddlCourseName.SelectedItem.Value _
Select a.CourseId Order By CourseId Descending
crseID = info.FirstOrDefault()
Session("Course") = crseID
sdsAddStudent.Insert()
FName.Text = ""
LName.Text = ""
Address.Text = ""
ddlCourseName.SelectedIndex = 0
Session("UserID2") = objUser
Session("RoleID2") = "f13b9bf3-593d-4170-bfaa-bc43655773e2"
sdsRoleStudent.Insert()
I know VB is different to C# MVC3 as this is 2008 and not MVC3 am just showing this code so people know that I am not after free code and have tried to make an effort which has not succeed.
Thank You For Your Kind Help People