SARAVAN
SARAVAN

Reputation: 15031

Read environment variables in web.config

Is there a way write code in web.config file using preprocessed function. Say I created environment variables like %Temp%, %WINDIR%. order to read these I can use the configurationManager class. But I dont want to use it. I woudl like to use a preprocessed function similar to timeStampPattern="{timestamp(local)}". Here timestamp(local) retrieves the value directly. So in a similar way can i read the environment variables %temp% and %windir% using preprocessed function if any exists?

Upvotes: 3

Views: 3433

Answers (3)

DaniilZ
DaniilZ

Reputation: 51

It can be done.

That is all you need to do: value="${envVarKey}

where envVarKey any environment variable.

Upvotes: 2

No Refunds No Returns
No Refunds No Returns

Reputation: 8336

Are you looking for Environment.getenvironmentvariable()? You will need to find and replace them yourself.

Upvotes: 2

John Saunders
John Saunders

Reputation: 161773

No. There's no way to do this.

Upvotes: 2

Related Questions