# Host Session Property - IP vs Hostname returned?

**URL:** <https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 23, 2020, 7:06pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765 "2020-12-23T19:06:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnIrving](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/johnirving/32/37638_2.png) [@JohnIrving](https://forum.inductiveautomation.com/u/JohnIrving)\
**Post date:** [December 23, 2020, 7:06pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/1 "2020-12-23T19:06:27Z")

</div>

Hello, I’d like to get the hostname of the machine the current session is running on. The [session properties document](https://docs.inductiveautomation.com/display/DOC80/Session+Properties) says that the host property reflects the “connecting system’s IP address or hostname”. What determines which is returned? A quick test returned my IP. Is there a way to make sure I get the hostname?

I see there is a scripting function that returns the hostname, system.net.getHostName, which should work fine but I’d prefer to use a session property if possible.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 23, 2020, 7:09pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/2 "2020-12-23T19:09:23Z")

</div>

You’ll probably have to ensure reverse DNS lookups work for your client IPs. If there is a NAT router involved anywhere, you’ll get that address/name, at least for browser sessions.

---

<div class="post-metadata">

**Author:** ![JohnIrving](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/johnirving/32/37638_2.png) [@JohnIrving](https://forum.inductiveautomation.com/u/JohnIrving)\
**Post date:** [December 23, 2020, 7:12pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/3 "2020-12-23T19:12:57Z")

</div>

Thanks, so seems like it will be safer to use the script method to make certain I’m always getting the hostname.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 23, 2020, 7:14pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/4 "2020-12-23T19:14:25Z")

</div>

I recommend testing many different network cases, with various browsers, whether using the session property or the script function.

---

<div class="post-metadata">

**Author:** ![JohnIrving](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/johnirving/32/37638_2.png) [@JohnIrving](https://forum.inductiveautomation.com/u/JohnIrving)\
**Post date:** [December 23, 2020, 7:53pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/5 "2020-12-23T19:53:38Z")

</div>

After some more testing, the script will not work for what I need because I was not realizing the script will always be running at the gateway scope so returns the gateway hostname instead of the local machine.

I am trying to limit certain pages to only be accessible on certain machines. device/identifier session prop may be an option as well, although I have concerns about that changing and needing fixed due to the warning in the description:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/139fc7ad05b3258c7a080dfc3a4d9f67510a6d78.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 23, 2020, 8:16pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/6 "2020-12-23T20:16:14Z")

</div>

You probably aren’t going to have a reliable solution with any browser. You need the mobile or the workstation products to have more access to local details.

Browsers actively interfere with what you are attempting as part of the broader malware-infested environment in which they swim.

---

<div class="post-metadata">

**Author:** ![JohnIrving](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/johnirving/32/37638_2.png) [@JohnIrving](https://forum.inductiveautomation.com/u/JohnIrving)\
**Post date:** [January 22, 2021, 3:09pm UTC](https://forum.inductiveautomation.com/t/host-session-property-ip-vs-hostname-returned/41765/7 "2021-01-22T15:09:06Z")

</div>

That makes a lot of sense. Where can I find more information on the additional local details that are available if using Workstation?

Would I be correct in thinking that the device/identifier session prop is safer from being reset in workstation than it would be in the browser?

To clarify what I’m trying to do even further, I don’t even need anything specific to the PC if I could set some sort of identifier while configuring the workstation shortcut. The page configuration will be used to always launch the correct page for that shortcut, but I want to prevent others who are using the project in a regular browser from navigating to the control page by figuring out the URL.

Seems like something like a parameter that could be configured in addition to the page config and writes to a session prop would be helpful, I could then identify any sessions launched by that shortcut.

Thanks again,
