Search code examples
c#asp.netwebformsforms-authentication

Forms Authentication IsAuthenticated Not Working External Link


  • I log in to website (tab 1) and connect to page that requires authentication.
  • I then create myself a link in word (can be any link from anywhere) but crucially linked to same default browser that retains the login details.
  • Clicking the link opens a new tab (tab 2) to same said website BUT it asks for login details!

Back end code to webpage has if (!HttpContext.Current.User.Identity.IsAuthenticated) then REDIRECT

I don't understand, if user is in tab 1 logged in and external link opens tab 2 in Chrome, why does it think the user is logged out... I probably should know why but I'm too old to spend years finding out why.

Hope someone can help.

[UPDATE] Debugging the code it appears the load event is loading twice. The first time Chrome's tab isn't open and IsAuthenticated is false, then 2nd time IsAuthenticated = true but it's too late as I have already actioned on the first call!


Solution

  • OK I found the problem. MS Outlook and MS Word appear to be the issue. Thanks to this I was able to respond accordingly: Why are cookies unrecognized when a link is clicked from an external source (i.e. Excel, Word, etc...)