473,511 Members | 14,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

beginner question: local IP-Address

I looked in the help but I cannot find the method to retrieve the IP-Address
of the local machine in the code behind (not the client machine, wich I can
retrieve with Request.UserHostAddress, but the IP-Address of the server where
the code behind is running).
I checked IPAddress Class but this seems not to be the correct one.
Thank you for your help
Nov 19 '05 #1
4 1798
You can do:

System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tName()).AddressList(0).ToString
"Carlo Marchesoni" <Ca*************@discussions.microsoft.com> wrote in
message news:B7**********************************@microsof t.com...
I looked in the help but I cannot find the method to retrieve the
IP-Address
of the local machine in the code behind (not the client machine, wich I
can
retrieve with Request.UserHostAddress, but the IP-Address of the server
where
the code behind is running).
I checked IPAddress Class but this seems not to be the correct one.
Thank you for your help

Nov 19 '05 #2
Request.ServerVariables("LOCAL_ADDR")

would provide the server's IP address, too.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
You can do:

System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tName()).AddressList(0).ToString
"Carlo Marchesoni" <Ca*************@discussions.microsoft.com> wrote in
message news:B7**********************************@microsof t.com...
I looked in the help but I cannot find the method to retrieve the
IP-Address
of the local machine in the code behind (not the client machine, wich I
can
retrieve with Request.UserHostAddress, but the IP-Address of the server
where
the code behind is running).
I checked IPAddress Class but this seems not to be the correct one.
Thank you for your help



Nov 19 '05 #3
I'm not sure if this exactly what you want to do, but you can display the
account that an ASP.net page is exeuting by in Sub Page_Load
lblAccount.text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
Hope this helps.

Sccr18

"Juan T. Llibre" wrote:
Request.ServerVariables("LOCAL_ADDR")

would provide the server's IP address, too.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
You can do:

System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tName()).AddressList(0).ToString
"Carlo Marchesoni" <Ca*************@discussions.microsoft.com> wrote in
message news:B7**********************************@microsof t.com...
I looked in the help but I cannot find the method to retrieve the
IP-Address
of the local machine in the code behind (not the client machine, wich I
can
retrieve with Request.UserHostAddress, but the IP-Address of the server
where
the code behind is running).
I checked IPAddress Class but this seems not to be the correct one.
Thank you for your help



Nov 19 '05 #4
That's not what he was looking for.

He was looking for "the IP Address of the
server where the code behind is running".

re:
lblAccount.text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
That should be
System.Security.Principal.WindowsIdentity.GetCurre nt.Name()

I published this short file I wrote, which retrieves the
account name ASP.NET is running under, a few days ago.

Check it out...

-----------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
-------------


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Sccr18" <Sc****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com... I'm not sure if this exactly what you want to do, but you can display the
account that an ASP.net page is exeuting by in Sub Page_Load
lblAccount.text = System.Security.Principal.WindowsIdentity.GetCurre nt().Name
Hope this helps.

Sccr18

"Juan T. Llibre" wrote:
Request.ServerVariables("LOCAL_ADDR")

would provide the server's IP address, too.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Joseph Byrns" <jo*********@nnoossppaamm-yahoo.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
> You can do:
>
> System.Net.Dns.GetHostByName(System.Net.Dns.GetHos tName()).AddressList(0).ToString
>
>
> "Carlo Marchesoni" <Ca*************@discussions.microsoft.com> wrote in
> message news:B7**********************************@microsof t.com...
>>I looked in the help but I cannot find the method to retrieve the
>>IP-Address
>> of the local machine in the code behind (not the client machine, wich I
>> can
>> retrieve with Request.UserHostAddress, but the IP-Address of the server
>> where
>> the code behind is running).
>> I checked IPAddress Class but this seems not to be the correct one.
>> Thank you for your help
>
>


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2094
by: TrashOverride | last post by:
Hello guys i have a question about apache... i have installed Apache 2.0.54 PHP 5 MySQL 4.01 and i was wondering if i could use a name to access my apache server -> not to use http://localhost but...
44
4126
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
14
1341
by: ed | last post by:
this script should create individual threads to scan a range of IP addresses, but it doesnt, it simple ... does nothing. it doesnt hang over anything, the thread is not being executed, any ideas...
1
1752
by: Rusty | last post by:
I am trying to find the ip of my machine, but all I get is the local ip, not the ip I want. This is a program that finds the local ip, what should be modified: #include <stdio.h> #include...
3
1268
by: gc | last post by:
Hello all, I'm working on a console app that takes as input a list of domain names then pings them. The data I want to work with is: long rtt (ping round trip time in ms) IPAddress ip...
20
2249
by: weight gain 2000 | last post by:
Hello all! I'm looking for a very good book for an absolute beginner on VB.net or VB 2005 with emphasis on databases. What would you reccommend? Thanks!
0
1010
by: hide1713 | last post by:
Hi everyone We are making a disk less workstation environment which support python.We use PXE DHCP TFTP to boot up disk less system.There are three choices as i know to set up a python environment...
2
3907
by: 000dreamsound000 | last post by:
Hi I am working on a security network camera system as part of a summer project of mine. The camera allows use of a TCP server for event configuration. I have coded a simple TCP server which beeps...
3
2747
Jezternz
by: Jezternz | last post by:
Easy to get the external ip adress, using the $SERVER var, but I want the local ip. My situation isnt normal by the way. Basicly im building simple intranet ( i want to run this on a local area...
2
201
by: Daniel | last post by:
Looking for a good resource for beginners? books, online anything that will get me started.. what im trying to focus on is building a small program in c# to look thru a few files in a folder...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.