473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.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 Applicatio?

Cheers,

JQ
Jun 27 '08 #1
1 4848
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.Host
Dim port as string = Request.ServerVariables("SERVER_PORT")
Dim MyUrl As Uri = Request.Url
Dim fullappnameProtocolAndPort As String = "The full URL, protocol and port for the application is : " _
& Server.HtmlEncode(MyUrl.Scheme) & "://" & fullappname & ":" & port & Request.ApplicationPath & "/"

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.comwrote 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.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 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
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...
1
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
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...
2
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...
3
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:...
0
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...
1
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...
21
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'...
0
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...
0
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,...

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.