I am using https://myapps.microsoft.com/ as my login page.
However there are instances that when I click my application from the dashboard, I get a session expired when page is redirected. I have to close and click it again that's the time I get the session in my page.
Second scenario is I always get a "Bad Request - Request Too Long error ". What configuration did I miss?
Here's the code I use:
public class Logon
{
[Authorize]
public void Authenticate()
{
if (ClaimsPrincipal.Current.Identity.IsAuthenticated)
{
string userfirstname = ClaimsPrincipal.Current.FindFirst(ClaimTypes.GivenName).Value;
string userlastname = ClaimsPrincipal.Current.FindFirst(ClaimTypes.Surname).Value;
// do some checking
// set session and redirect
// when page is redirected to Home Index, session checking occur
Response.Redirect("~/Home/Index");
}
}
}
As for the Azure Settings
My homepage URL and Reply URL is set to: https://mysite/logon/authenticate hosted on my local IIS.
I added my app through App Registration menu in Azure AD panel.
Thank you.