473,668 Members | 2,348 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.UserHos tAddress, 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 1805
You can do:

System.Net.Dns. GetHostByName(S ystem.Net.Dns.G etHostName()).A ddressList(0).T oString
"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:B7******** *************** ***********@mic rosoft.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.UserHos tAddress, 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.ServerV ariables("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*********@nn oossppaamm-yahoo.com> wrote in message
news:eJ******** ******@TK2MSFTN GP15.phx.gbl...
You can do:

System.Net.Dns. GetHostByName(S ystem.Net.Dns.G etHostName()).A ddressList(0).T oString
"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:B7******** *************** ***********@mic rosoft.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.UserHos tAddress, 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.Wind owsIdentity.Get Current().Name
Hope this helps.

Sccr18

"Juan T. Llibre" wrote:
Request.ServerV ariables("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*********@nn oossppaamm-yahoo.com> wrote in message
news:eJ******** ******@TK2MSFTN GP15.phx.gbl...
You can do:

System.Net.Dns. GetHostByName(S ystem.Net.Dns.G etHostName()).A ddressList(0).T oString
"Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
message news:B7******** *************** ***********@mic rosoft.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.UserHos tAddress, 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.Wind owsIdentity.Get Current().Name
That should be
System.Security .Principal.Wind owsIdentity.Get Current.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.Nam e()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsI dentity.GetCurr ent.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****@discuss ions.microsoft. com> wrote in message
news:4E******** *************** ***********@mic rosoft.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.Wind owsIdentity.Get Current().Name
Hope this helps.

Sccr18

"Juan T. Llibre" wrote:
Request.ServerV ariables("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*********@nn oossppaamm-yahoo.com> wrote in message
news:eJ******** ******@TK2MSFTN GP15.phx.gbl...
> You can do:
>
> System.Net.Dns. GetHostByName(S ystem.Net.Dns.G etHostName()).A ddressList(0).T oString
>
>
> "Carlo Marchesoni" <Ca************ *@discussions.m icrosoft.com> wrote in
> message news:B7******** *************** ***********@mic rosoft.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.UserHos tAddress, 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
2099
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 to use example1.com? i have tried to adjust the vhost section acording to the guide in the apache web page, but when i try i get error 404. also when i try http://localhost i also get 404. i've attached my .conf file. i want to access my server...
44
4200
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 must be many know the answer here. thanks
14
1354
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 anyone? ---------- import socket import threading import traceback
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 <netdb.h> int main() { char hostn; //placeholder for the hostname
3
1279
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 string hostName Right now the app just prints the info in the order it's placed on the
20
2280
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
1019
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 for diskless system. First Solution, Use a initrd image with everything inside as the root file system.Diskless computer boots up with a kernel and this rootfs image.If everything goes fine.We could use python in the ram disk.In my...
2
3923
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 and accesses the camera interface (through a web browser) when a switch connected to the camera is pressed: SOCKET client; sockaddr_in from; int fromlen=sizeof(from); while(true)
3
2755
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 network (will be hundreds of people) not on the web, so for logins im gonna be using local ip's, is there any way I can get them easily? $HTTP_SERVER_VARS <- people have said this would work.. but would it actually work in a lan invroment, im not so...
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 that contain certain words / messages ( i know that is probably more than a beginner can do right off the bat ) but i have other programmers available that can help, but rather try myself before i get them involved.. example of what i mean
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8791
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8577
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7398
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2786
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 we have to send another system
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.