I'm a system administrator and I'd like to have only one place to change/check for a NAS path in all web.config or global.asa files, in this way, any time the path change, I do not have to go into all web.config or global.asa files make the necessary change and hoping to avoid any mistake or forgotten file...
My idea is to have an environment variable on the local server that can be set and update.
<!-- metadata type="typelib" file="C:\Program Files\Common Files\System\ADO\msado15.dll" -->
<script language="vbscript" runat="server">
Sub Application_OnStart
dim strNAS
strNAS = ${MyEnvironmentVar} ???
Application("NAS") = strNAS
End Sub
' Instead of using an hard-coded path like below
'Application("News")="File Name=\\NAS04.MyDomain.com\mydata$\myfile.udl"
'I'd like to use a more flexible way...
Application("News")="File Name=" + Application("NAS") + "mydata$\myfile.udl"
or
Application("News")="File Name=" + ${MyEnvironmentVar} + "mydata$\myfile.udl"
...
</script>
$MyEnvironmentVar
is the variable set on the local server as environment variable and have the path to the current storage system...
MyEnvironmentVar = "\\NAS04.myDomain.com\"
I saw around the web something like Environment.getenvironmentvariable()
, but I'm not sure how to use it and if it works in the web.config and global.asa files.