In my application,to add a new student i have to pass the StudentId of currently logged in Student who is in roles of Students.When i provide the StudentId as query string in my browser,it adds the new student but the problem is when i have to get that StudentId from trhe students Table,the Student Id is not returned back.I have used debugger and i can see the name of the logged user but the id is not returned
Have used this code here but it returns null results.
MembershipUser student = Membership.GetUser(Page.User.Identity.Name);
int StudentId = ManageStudents.GeStudentId((Guid)user.ProviderUserKey);
Here is the Method
public int GetStudent(Guid userId)
return db.Students.FirstOrDefault(x => x.UserId == userId).StudentId;
This returns studentId as 0..Someone who can help me solve this?