By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Application Address

P: n/a
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns
the full path of the request including host name but on my machine for some
reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon
Nov 19 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
start here maybe
for(int i = 0;i < Request.ServerVariables.Count;i++)

{

Response.Write(Request.ServerVariables[i].ToString() + "<br>");

}
--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Shimon Sim" <es*****@att.net> wrote in message
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it
returns the full path of the request including host name but on my machine
for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #2

P: n/a
Try Request.Url
"Shimon Sim" <es*****@att.net> píše v diskusním příspěvku
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it
returns the full path of the request including host name but on my machine
for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #3

P: n/a
If you are in a virtual dir it will show that, not the base URL
--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jakub" <ja*****@centrum.cz> wrote in message
news:em****************@TK2MSFTNGP14.phx.gbl...
Try Request.Url
"Shimon Sim" <es*****@att.net> píše v diskusním příspěvku
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it
returns the full path of the request including host name but on my
machine for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon


Nov 19 '05 #4

P: n/a
Whoops... nevermind...
Thought that was Request.Servervariables["URL"]

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jakub" <ja*****@centrum.cz> wrote in message
news:em****************@TK2MSFTNGP14.phx.gbl...
Try Request.Url
"Shimon Sim" <es*****@att.net> píše v diskusním příspěvku
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it
returns the full path of the request including host name but on my
machine for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon


Nov 19 '05 #5

P: n/a
<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.ServerVariables("HTTP_HOST")
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px" Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>
Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns
the full path of the request including host name but on my machine for some
reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon


Nov 19 '05 #6

P: n/a
You can also use Request.Url.Host

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.Url.Host
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px" Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>

Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns
the full path of the request including host name but on my machine for some
reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #7

P: n/a
thanks. Request.Url has plenty info and works as expected.
What's wrong with RawUrl??
Shimon.
"Jakub" <ja*****@centrum.cz> wrote in message
news:em****************@TK2MSFTNGP14.phx.gbl...
Try Request.Url
"Shimon Sim" <es*****@att.net> píše v diskusním příspěvku
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it
returns the full path of the request including host name but on my
machine for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon


Nov 19 '05 #8

P: n/a
Thanks Juan
Shimon.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message news:uO****************@TK2MSFTNGP11.phx.gbl...
You can also use Request.Url.Host

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.Url.Host
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px" Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>

Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns
the full path of the request including host name but on my machine for some
reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #9

P: n/a
/me raises an eyebrow

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Juan T. Llibre" <no***********@nowhere.com> wrote in message news:uO****************@TK2MSFTNGP11.phx.gbl...
You can also use Request.Url.Host

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.Url.Host
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px" Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>

Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns
the full path of the request including host name but on my machine for some
reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #10

P: n/a
I'm a quick study, Karl.

;-)

Actually, I don't know why that
didn't work when I first tested it.

The first time I ran it, it only returned the IP address.

When I ran it again, after you objected, it returned
what it's supposed to return: the hostname.

I attribute it to evil internet pixies. :-)

Juan T. Llibre
ASP.NET MVP
===========
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl...
/me raises an eyebrow

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uO****************@TK2MSFTNGP11.phx.gbl...
You can also use Request.Url.Host

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.Url.Host
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px"
Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>

Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message
news:eg****************@tk2msftngp13.phx.gbl...
Hi
I need to get application address that will look like this
http://www.mysite.com
I tried already Request.FilePaht that the documentation says that it returns the full path of the request including host name but on my machine for some reason it only returns virtual path and is equal RawUrl.

What's wrong? How can I get host name programmatically?
Shimon

Nov 19 '05 #11

P: n/a
Funny, we have leprechauns in canada ;)

Cheers,
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I'm a quick study, Karl.

;-)

Actually, I don't know why that
didn't work when I first tested it.

The first time I ran it, it only returned the IP address.

When I ran it again, after you objected, it returned
what it's supposed to return: the hostname.

I attribute it to evil internet pixies. :-)

Juan T. Llibre
ASP.NET MVP
===========
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl...
/me raises an eyebrow

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uO****************@TK2MSFTNGP11.phx.gbl...
You can also use Request.Url.Host

<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim dnsname As String = Request.Url.Host
Label1.Text = dnsname
End Sub
</script>
<head>
<title>Retrieve Server DNS Name</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px"
Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>

Juan T. Llibre
ASP.NET MVP
===========
"Shimon Sim" <es*****@att.net> wrote in message
news:eg****************@tk2msftngp13.phx.gbl...
> Hi
> I need to get application address that will look like this
> http://www.mysite.com
> I tried already Request.FilePaht that the documentation says that it

returns
> the full path of the request including host name but on my machine for

some
> reason it only returns virtual path and is equal RawUrl.
>
> What's wrong? How can I get host name programmatically?
> Shimon
>
>


Nov 19 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.