# ASP.NET Webforms IsAuthenticated and User not being set

**URL:** <https://devforum.okta.com/t/asp-net-webforms-isauthenticated-and-user-not-being-set/16616>\
**Category:** Questions\
**Created:** [October 16, 2021, 12:32am UTC](https://devforum.okta.com/t/asp-net-webforms-isauthenticated-and-user-not-being-set/16616 "2021-10-16T00:32:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![garymon](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@garymon](https://devforum.okta.com/u/garymon)\
**Post date:** [October 16, 2021, 12:32am UTC](https://devforum.okta.com/t/asp-net-webforms-isauthenticated-and-user-not-being-set/16616/1 "2021-10-16T00:32:19Z")

</div>

I have the [Asp.net](http://Asp.net) MVC Example project configured to use my dev okta SSO.  
I have modified my actual application to use the same code and values.

With the example app I can log in and view the profile page showing the correct user data and log out.  
With my real application:

1. If I am not already logged in, I will get the login page as expected. After logging in I am redirected to my external login page where I expect to be redirected to after logging in. Except: Request.IsAuthenticated is False and Page.User.Identity.isAuthenticated is also false.
2. If I start a new debugging session after #1 I will not be redirected to the okta login, and instead go straight to my external login page where I am once again told I am not not authed.
3. If I now launch the Example project, I will also skip the okta login but if I debug the profile page, I can see that IsAuthenticated is true and the Page.User object is filled in corrected.
4. if I now click logout using the example app I get logged out as expected.
5. If I launch my real app, I will now be redirected to the okta login page.

To summarize.  
The app knows if the login should be shown or not.  
The app does not know if the user is authorized after successfully logging in.

Any ideas why I have this disconnect?

Thank you,  
Gary

---

<div class="post-metadata">

**Author:** ![garymon](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@garymon](https://devforum.okta.com/u/garymon)\
**Post date:** [October 19, 2021, 10:48pm UTC](https://devforum.okta.com/t/asp-net-webforms-isauthenticated-and-user-not-being-set/16616/2 "2021-10-19T22:48:34Z")

</div>

I finally tracked down the issue. In the CookieAuthenticationOptions I had a carry over value from my old auth system that specified a value for AuthenticationType. After removing that parameter I get the User object populated as expected. Hopefully this is of help to someone else. 👍

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [October 20, 2021, 10:48pm UTC](https://devforum.okta.com/t/asp-net-webforms-isauthenticated-and-user-not-being-set/16616/3 "2021-10-20T22:48:35Z")

</div>

Closed on October 20, 2021, 10:48pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
