0

I've got a page that's basically a support request form for customers to fill out and submit... It's in ASP.net with C# as the code behind. I've managed to get the computer name to populate into one of the forms text boxes using 'System.Environment.MachineName;' and I've come up against the monumental problem of this not working unless it's in some sort of intranet type environment where it can do it's reverse DNS lookup... This is fine as the page will usualy be accessed within our AD Forest(s). The problem I am coming up against now is unless I disable the proxy in Internet Explorer, I keep getting the proxyname/address back instead of the computer name. It works perfect if I disable the proxy...

So is there a away I can get this 2 or 3 lines of code to go out of the proxy but the rest of the page stay in? Or maybe if I have to get the whole page to run out of the proxy as the reference points are all local it should still work without the webproxy..?

Any help is much appriciated!

Thanks, Adam.

API
  • 125
  • 2
  • 12
  • Are you trying to get the name of the machine that is running the website or the client machine name? – Charles380 Apr 17 '13 at 12:02
  • I'm trying to get the machine name for the person who has visited the website... I'm not quite sure what you mean really, Client Machine being the Client who is visiting the page/site and it is the Machine that is running the website also... Unless you mean the server the site is hosted on, in which case I definitely don't want the machine name of the server where the page is located. – API Apr 17 '13 at 17:38

2 Answers2

0

I'm not 100% on this because I don't have a situation where I can test this code but I believe this is what you want

System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName
Charles380
  • 1,269
  • 8
  • 19
  • Didn't need to bypass the proxy from code in the end, just added the site into the proxy bypass list on the server/client proxy bypass list all working ok :) Thanks for the help too! :) – API Apr 23 '13 at 09:42
0

Didn't need to bypass the proxy from code in the end, just added the site into the proxy bypass list on the server/client proxy bypass list all working ok :) Thanks for the help too! :)

System.Net.Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName is what I used to make it work :)

API
  • 125
  • 2
  • 12