473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET and Current hostname and Port

In Silverlight Application it's possible to query current Application's
hostname and port using namespace Windows.System and code like
below

String hostname = Application.Cur rent.Host.Sourc e.Host + ":" +
Application.Cur rent.Host.Sourc e.Port;

I tried to find out how to do this in ASP.NET Application but couldn't
succeeded.
Does anyone know how to get same result in ASP.NET Applicatio?

Cheers,

JQ
Jun 27 '08 #1
1 4858
re:
!I tried to find out how to do this in ASP.NET Application but couldn't succeeded.
!Does anyone know how to get same result in ASP.NET Applicatio?

Dim fullappname as string = Request.Url.Hos t
Dim port as string = Request.ServerV ariables("SERVE R_PORT")
Dim MyUrl As Uri = Request.Url
Dim fullappnameProt ocolAndPort As String = "The full URL, protocol and port for the application is : " _
& Server.HtmlEnco de(MyUrl.Scheme ) & "://" & fullappname & ":" & port & Request.Applica tionPath & "/"

That code will also give you the correct protocol.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"John Q" <jo****@mail.co mwrote in message news:fu******** **@nyytiset.pp. htv.fi...
In Silverlight Application it's possible to query current Application's
hostname and port using namespace Windows.System and code like
below

String hostname = Application.Cur rent.Host.Sourc e.Host + ":" + Application.Cur rent.Host.Sourc e.Port;

I tried to find out how to do this in ASP.NET Application but couldn't succeeded.
Does anyone know how to get same result in ASP.NET Applicatio?

Cheers,

JQ


Jun 27 '08 #2

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

Similar topics

2
9820
by: Tim Veldhuizen | last post by:
Hi all! I'm attempting at writing a networked program. It is going to be a threaded irc server in c++ using almost nothing but oop code. And it needs to know the full hostname of the users that connect to it. I already get some info from this code: workersock = accept(mastersock, &sockaddr, &addrlen); printf("Received a Client Connection from: %s port: %d fd: %d\n", inet_ntoa(sockaddr.sin_addr), ntohs(sockaddr.sin_port), workersock);
1
1898
by: Lamis | last post by:
Hi, I need to change my hostname in my machine using .Net and C# thanx for the help -- LZ
0
1194
by: Laszlo Nagy | last post by:
I'm running a service on a machine. The service is written in Python (of course) and it connects to an XMLRPC server periodically. It recreates the ServerProxy instance each time it needs to connect to the RPC server. The server is created with this code: server = xmlrpclib.ServerProxy(local.SERVER_URL,allow_none=True) # local.SERVER_URL is something like 'https://myserver.com:3421'
2
3702
by: Laszlo Nagy | last post by:
Hello, I asked this question about a week ago, but I did not provide a traceback. Here is the traceback: File "/usr/local/lib/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python2.4/xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "/usr/local/lib/python2.4/xmlrpclib.py", line 1129, in request
3
7219
by: Mark Delaney | last post by:
When using the MS SQL 2005 JDBC driver, I now need to have the DNS name resolution to the client correctly set up. If not I get the following error: SQLState: 08S01 SQLError: 0 Message: hostname : hostname Where "hostname" is the client host name. It doesn't seem to matter if I
0
1859
by: ranishobha21 | last post by:
Dear All, I am sending the code below.i have not specifies the host name.i want to send command to server and get the response from it.but it doesnt work.when i connect with the telnet using ssh to remote machine it works. i type telnet hostname->username->password and then i can login to the
1
4127
by: iceboy | last post by:
Hello to all,I have a problem to connect PHP & MySQL together. I have created a form that gets the username & password from admin and connect him to database.the part of PHP script that connect to mysql is as follow: $db=mysql_pconnect("hostname",$username,$password); if(!$db){ echo"ERROR:connecting failed"; exit; } else echo"you have connected to database succsessfully"; I want to know what should i write instead of "hostname"...
21
5239
by: lyealain | last post by:
when i write http;//localhost on my browser.. it come out bad request on invalid hostname... just these 4 words... i have no idea of wath is the error.. so i write mysqladmin -h 'localhost' version into my cmm prompt it said error "unknown mysql server host' localhost <11004> check mysqld is running on the port by doing telnet' localhost' 3306.. how to do that...???
0
4958
by: John Q | last post by:
In Silverlight Application it's possible to query current Application's hostname and port using namespace Windows.System and code like below. Iused it in WCF client call. String hostname = Application.Current.Host.Source.Host + ":" + Application.Current.Host.Source.Port; I tried to find out how to do this in ASP.NET Application but couldn't succeeded. Does anyone know how to get same result in ASP.NET Application?
0
8428
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
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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
8531
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
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
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...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.