Ravi

Ravi

  • NA
  • 54
  • 501

Anti-Forgery for security audit.

Apr 22 2020 9:49 AM
Hi Sir,
 
Can you please share code for anti-forgery for security audit purpose. I did it but they are asking to change the token every time the page loads or postback. Please share the code to [email protected]. Or explain here with the complete code asap.
 
This is the code i used:
  1. DivCSRF.InnerHtml = AntiForgery.GetHtml().ToString()  
  2. If IsPostBack Then  
  3.    Try  
  4.       AntiForgery.Validate()               
  5.    Catch ex As Exception   
  6.       Response.Redirect("~/Unauthorize.aspx"False)                   
  7.       Exit Sub   
  8.    End Try   
  9. End If  
Thanks & Regards
Ravi Mishra

Answers (1)