well, in asp.net and using IIS, there is not really a section called environment variables.
However, it common to have a bunch of settings and variables for use throughout the applcation.
And as a general rule, web.config is used for this purpose.
I mean, because web.config can often be quite large, messy and have a lot of sections?
Well, then for the most part, I often use and let project settings for this purpose.
so, go project->"my project name" properties, and we have this:
So in above, we can have conneciton settings, even simple things like say some colors for backgrounds, and all kind of things - even things like location information etc.
For example, in above, I have highlighted the value CompanyName. Now, in code I am free to use that setting like this:
Say I have a div with runat=server, then in code I can do this:
Dim strWelcomMessage = "Welcome to " & My.Settings.CompanyName
Me.WelcomeMsg.InnerHtml = "<h2>" & strWelcomMessage & "</h2>"
And now we see this on the web page:
So, just use the application settings. put your values, connection strings etc. into the project settings.
So, I not aware that any "environment" tags can be placed in your web config (it will actaully result in a compile error from IIS complaining about that tag not legal in your web confiig.
However, you are certainly free to setup string and even connection strings as per above.
In fact, I prefer using the project settings, since the alternative is deep diving into the web.config file, and that always a big hairy cat ball of markup - which I don't like to mess with.
For the most part, we consider these values read-only anyway, so it not at all clear why your looking to use a "environment" tag, since we have the long time and long used web.config for such settings anyway.
At the end of the day, the goal here is:
How and where can I put a bunch of the application and web site settings I need?
And the answer in general is to simple use the Project->My Project settings.
There might be some other issue here? but in standard asp.net, and say .net 4.8? Just use the project settings. Those settings most certainly wind up in web.config, but I not sure that matters.
So, now, we don't have something called "environment variables" in .net, but we have a place for such settings in our applications.