The bill, which unanimously passed the Senate shortly after midnight Saturday, also prohibits schools and universities from requesting that a student or applicant log onto a social networking site so that school officials can access the site profile or account.
The bill includes exemptions for investigations by police agencies or a school's public safety department if criminal activity is suspected.
Lawmakers approved the bill after deleting an amendment that expanded the scope of its privacy protections to elementary and secondary school students.