Originally posted by fpw23
The application page (.html) loads an initial screen that contains no protected resources. In order to load protected resources it has call ASP.NET pages (.aspx) which serve up JSON and/or XML instead of HTML. When XMLHttpRequest attempts to send a request to one of my ASP.NET pages, then if the user is not authenticated the application will receive HTML from the Login.aspx page (which it expects to receive only if the user is unauthenticated).
Upon receiving the Login.aspx HTML, the application stops what it's doing, asks for a user name and password, and then sends a request to an unprotected ASP.NET page (still .aspx) which performs authentication and returns success or failure. Once the user has been authenticated and the authorization cookie set in the response, requests to protected ASP.NET pages will succeed and, instead of returning the Login.aspx HTML, will return the valid XML or JSON expected by the application, and from then on everything proceeds as usual.
So login functionality has the following flow:
1) Load the application page with its linked .js files
2) Attempt to contact protected .aspx pages for application resources (causing ASP.NET to check authentication)
2A) Login fails
a. Prompt for username and password
b. Send credentials to unprotected .aspx page for authentication
c. Return to Step 2
2B) Login succeeds
a. Proceed to Step 3
3) Process XML or JSON from protected .aspx pages and run application
Comment