Posted on: 4/9/2014 5:51:01 PM | Views : 800

I pulled the code below for my master page out of a template 2012. In the master_page_Preload everything is failing when not past back.  It appears the usernamekey is string.empty, but the Identity.Name is valid when it is not post back. What could be going on?
private const string AntiXsrfTokenKey = "__AntiXsrfToken"; private const string AntiXsrfUserNameKey = "__AntiXsrfUserName"; private string _antiXsrfTokenValue; protected void Page_Init(object sender, EventArgs e) { // The code below helps to protect against XSRF attacks var requestCookie = Request.Cookies[AntiXsrfTokenKey]; Guid requestCookieGuidValue; if (requestCookie != null && Guid.TryParse(requestCookie.Value, out requestCookieGuidValue)) { // Use the Anti-XSRF token from the cookie _antiXsrfTokenValue = reque ...

Go to the complete details ...