ASP.NET ViewStateUserKey Is Not Set

Severity: Low

Invicti detected that ASP.NET ViewStateUserKey is not set inside of the ASP.NET application


When the ASP.NET ViewStateUserKey is not set, that makes it easier for an attacker to perform CSRF attacks. ViewStateUserKey prevents the attack by allowing you to assign an identifier to the view-state variable for individual users so that attackers cannot use the variable to generate an attack.

Actions To Take#

Please add the code below to all of your pages.


using System;

using System.Web.UI;

class ExampleClass : Page


    protected override void OnInit (EventArgs e)


        // Assuming that your page makes use of ASP.NET session state and the SessionID is stable.

        ViewStateUserKey = Session.SessionID;



Build your resistance to threats. And save hundreds of hours each month.

Get a demo See how it works