I have my GUI files published on a server... this server is where the IIS is running..
Now i access my GUI from a remote machine. how can i get this machines IP address or username.
I get t开发者_JS百科he server name of the machine using this code:
string svrName = System.Net.Dns.GetHostName();
please help thanks...
maybe i was not clear enough:
Let me explain again..
there are 2 machines A and B.. A is where i have my published files for the GUI and also the IIS... the above code gives me the name of machine A
now i call the GUI from machine B. and i want the name of machine B
To get a remote user's IP from Asp.Net, you can use Request.ServerVariables["REMOTE_ADDR"]
or Request.UserHostAddress
.
The Request
object should be available anywhere in your ASPX page.
I don't think it's possible to reliably get the hostname through ServerVariables.
Assuming I understand what you're asking, System.Web.HttpContext.Current.Request will give your server-side code lots of information about the client making the request.
精彩评论