Setting ViewStateUserKey gives me a “Validation of viewstate MAC failed” error

后端 未结 5 1900
清歌不尽
清歌不尽 2020-12-06 09:55

I have the following in my BasePage class which all my ASPX pages derive from:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);         


        
5条回答
  •  北海茫月
    2020-12-06 10:46

    I fixed it for now by changing the code to:

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
    
        if (User.Identity.IsAuthenticated)
            ViewStateUserKey = User.Identity.Name;
    }
    

提交回复
热议问题