|
|
|
You can access a lot of useful information through the ServerVariables collection, but this has a price in terms of performance. More precisely, the first time you reference this collection in a page, IIS must collect all the data that is necessary to create the collection. All the subsequent references come for free, however.
In some cases you can substitute a reference to a server variable with a constant value. For example, many developers use the LOCAL_ADDR, SERVER_PORT, and PATH_INFO server variables to dynamically build a path relative to the current page or the domain that hosts the page: |
However, these values vary infrequently, so you should consider using constant strings instead. If you want to build a page that works correctly regardless of the domain it runs under (which is especially useful to debug the page before uploading to the real Internet server) you can store the domain path in an Application variable in the Application_OnStart procedure in GLOBAL.ASA.
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|