Torna al Thread

Private Sub master_Page_PreLoad(sender As Object, e As System.EventArgs) If (Not IsPostBack) Then ' Impostare il token Anti-XSRF ViewState(AntiXsrfTokenKey) = Page.ViewStateUserKey ViewState(AntiXsrfUserNameKey) = If(Context.User.Identity.Name, String.Empty) Else ' Convalidare il token Anti-XSRF If (Not DirectCast(ViewState(AntiXsrfTokenKey), String) = _antiXsrfTokenValue _ Or Not DirectCast(ViewState(AntiXsrfUserNameKey), String) = If(Context.User.Identity.Name, String.Empty)) Then Throw New InvalidOperationException("Convalida del token Anti-XSRF non riuscita.") End If End If End Sub
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5