cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jsvignesh
Level 2

Dynamic IP Address in web.config

Please help me how to get the IP address of the local machine (assuming local machine has IIS installed) where setup.exe is installed using install shield setup.

I want to change the host ip address through XML File Changes wizard in the Install shield basic project just like the below example.

I knew the following code/property will dynamically get the sql server's, server name, database name, sql server user id and sql server password.

Data Source=[IS_SQLSERVER_SERVER];Initial Catalog=[IS_SQLSERVER_DATABASE];Integrated Security=False;User ID=[IS_SQLSERVER_USERNAME];Password=[IS_SQLSERVER_PASSWORD]

What is the similar syntax to get the IP address of the local machine?

For eg., My scenario in web.config file is as follows


Regards,
Srivignesh Jaganathan
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

There's no built-in property for the IP address, but for some approaches using scripting you might look around www.installsite.org in the InstallScript Samples > Network category.
0 Kudos
Christopher_Pai
Level 16

jsvignesh wrote:
What is the similar syntax to get the IP address of the local machine?


127.0.0.1

Other then using the loopback IP, this is a very bad idea to put the current IP into the web.config. If the machine's IP changes, or it's cloned your application will become broken. It would be better for your webapp to make calls into System.Net.Dns.GetHostByName() at runtime.
0 Kudos