This is one of the most widely used methods to protect pages from anonymous access. This is sufficient for most of the cases and
AFAIK, there is no flow for this method. The only two problems are :
1) If session is not enabled on browser, this will fail.
2) Timeout is another problem. When user needs to fill a long form with many large texts etc., by the time, they fill it (after taking sufficient free time in between), the session might have timed out. Then they may have to enter all those details again.
The other method is to use Windows NT / 2000 based security. The admin pages all need to put in a directory (possibly with sub-directories also). Let the directory name be "admin".
Then server administrator need to create a user account on server. The folder admin together with all its sub-directories and all files in them should be accessible only to this user. This can be done by right-clicking the folder and selecting properties. Then open the security tab. Normally all server administrators will be able to do it.
Then through IIS manager, Open the property sheet for the admin folder. Click directory security tab. De-select the checkbox labelled anonymous access. This will prevent the access to the pages of this directory through the user IUSR_<computername>.
Now, there are two types of authenticated access. 1) Basic authentication 2) windows NT challenge / response. In basic method, the username / password are sent through the HTTP header whenever a page is accessed. The username and password will be sent (through HTTPheader) in uuencoded form. This provides only a basic level of privacy. A hacker can decode them without much problem.
Select windows NT challenge / response option. In this method, password is sent always in an encrypted fashion between client and server. The key for encryption will also change from request to request. (I am not explaining the full series of operations).
There are 3 drawbacks for windows NT challenge / response method.
1) It will work only in IE 3.0 and later only. To make it work in netscape a free software known as Microsoft Authentication proxy for Netscape Navigator needs to be downloaded from microsoft site and installed.
2) This method will not work through proxies. Only basic method will work
3) When resources (databases, images) need to be accessed through multiple servers, this method fails.
Then when a page from admin folder is accessed for the first time, it will display a login box. Visitor needs to supply a username, password and a domain in some cases. You don't need to check anything for each page.
The following code gives the authentication username, password and authentication method incase you need it for some purpose.
Request.ServerVariables("AUTH_USER") - username
Request.ServerVariables("AUTH_PASSWORD") - password
Request.ServerVariables("AUTH_TYPE") - Type of authentication.
You will not get the password if authentication type is windows NT challenge / response.
NT based security is best for preventing direct download of some exe / PDF files which are distributed through net.