I'm reviewing the security of an ASP.NET website that is about 7 years old. At the time the site was created the Microsoft guidance was to add the following to a common Base Page (inherited by all code behind pages):
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
MyBase.OnInit(e)
If Request.IsSecureConnection = True Then
ViewStateUserKey = Session.SessionID
End If
End Sub
This advice comes from the following MSDN Article from 2005.
My question is if this is still a valid and effective technique to protect against CSRF attacks.
Note, I read an SO question about this topic, but it appears the Visual Studio 2012+ project auto generated protection for CSRF are added to Master Pages. The site I'm reviewing doesn't use Master Pages because of CSS conflicts, and it is not in scope to add Master Pages into the current update.