Attorney General Bob McDonnell said he would seek legislation to require convicted sex offenders there to register their online identities with the state to help MySpace and other Web sites frequented by teenagers more easily block access. Senators Charles E. Schumer, Democrat of New York, and John McCain, Republican of Arizona., announced plans for similar federal legislation last week, but theirs would apply only to those on probation or parole. Mr. McDonnell’s plan for Virginia would apply to all convicted sex offenders. Hemanshu Nigam, MySpace’s chief security officer, applauded the Virginia announcement. “This legislation is an important recognition that the Internet has become a community as real as any other neighborhood and is in need of similar safeguards,” Mr. Nigam said.