Often, a program is comprised of several (sometimes hundreds or thousands) files that work together. This entails one file "calling" another, or redirecting to another. When a user enters the portal, for example, the file InitParams.aspx
is read and executed, and it then redirects to the file InstallAndDetect.asp
, which calls a bunch of JavaScript files like LoginTimeout.js
, install.js
, detection.js
and more. Then, it redirects to Login.asp
, which is the page in which the user has to feed in his authentication credentials. In the following examples, we see a script (left) that has four include
commands, where each of the .inc
files has more code that can be used by the primary script. By using .inc
files, we can reuse the same code or content in multiple places. On the right piece of code, we see a script that ends with the command response.redirect
, which tells the browser to request another file (/InternalSite/Validate.asp
) and process it.
Depending on the way the code is written, this can be done automatically by the browser, or it can stop and wait for the user to do something (like the Login page).
If you are wondering about the JavaScript files we mentioned previously, then this is also a very common practice with ASP. ASP code runs on the server, and the data that gets sent to the client is just static HTML. Often, we may want some code to run on the client side too, and that's where JavaScript complements ASP. For example, you already know that UAG installs ActiveX controls as part of the endpoint client installation. The process of ActiveX installation needs to be done on the client side, and for that, a JavaScript function is used—it's contained in the script file Install.js
, which we mentioned previously, and looks like this: