1

After successful authentication for Azure AD in ASP.NET C# it, the home page is not getting in as authenticated.

 @if (Request.IsAuthenticated)
    {
        <h4>Welcome @ViewBag.User.DisplayName!</h4>
        <p>Use the navigation bar at the top of the page to get started.</p>
    }
else
    {
       //Its going in Else condition
        @Html.ActionLink("Click here to sign in", "SignIn", "Account", new { area = "" }, new { @class = "btn btn-primary btn-large" })
    }

But when I see the log in the Azure for the status problem it says it success.

enter image description here

When I try to debug in Visual Studio Locally everything works fine it goes in the IsAuthenticated as true and works perfect. But the only problem in when we publish this in Production the problem arise as explained above.

1

1 Answer 1

1

If you are using Dot net core then just Call app.UseAuthentication() before app.UserMvc(...) in Configure Method in your Startup.cs class.

Also You can take a look at this thread WebForms Forms Authentication: Request.IsAuthenticated=false after successful log in and redirect. But

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks will check and get back to you.
Sorry for my late reply but that didn't work with my project.. but my company at that time didn't want to use the azure login anymore. thanks once again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.