| Using server variables in .IDC Files |
People often want to use server variables (like REMOTE_USER) inside
their .IDC files. Commonly, this is asked for in order to
Reading this server variable starting with IIS 2.0 is no problem - they are available in the .IDC file. With IIS 1.0, however, these variables are only available in the .HTX file. In order to access them in the .IDC file with IIS 1.0 you have to chain two IDC/HTX file sets: Use your first .HTX file to create a form that includes the needed server variables as hidden fields, as in this example:
Set this coding to your client's browser and await for the return to your second IDC/HTX file set (the one you are doing "real work" with). Inside the second sets .IDC file you can now freely reference the fields you have created with your first set of files. In the above example, the set now includes a variable "rem_user" which holds the value of the %REMOTE_USER% variable. You can use the rem_user variable in any way you like. Please note that being forced to use two sets of files is not really unnatural. Most applications that require database access to server variables will respond to some sort of form. So this form is not produced by a static HTML page but rather by a dynamic one - your first fileset. Nothing to worry about, no bad feelings at the users' side. However, please note that there are some drawbacks when you use this method for authentication purposes. If the user looks at your HTML (via his/her browsers' functions) he/she will be able to see your hidden fields! A better solution is to use IIS' NT based authentication with this. When using this information, please keep in mind that IDC has been superseeded by Active Server Pages (ASP). If you are planning for a new project, we strongly recommend using ASP instead of IDC. |
Copyright © 1997, 98 by Adiscon
GmbH, Germany. All rights reserved. |