Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Application Address

Reply
Thread Tools

Application Address

 
 
Shimon Sim
Guest
Posts: n/a
 
      01-12-2005
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


 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
news:eggRj6O%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Jakub
Guest
Posts: n/a
 
      01-12-2005
Try Request.Url


"Shimon Sim" <(E-Mail Removed)> píše v diskusním příspěvku
news:eggRj6O%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message
news:emyhIDP%(E-Mail Removed)...
> Try Request.Url
>
>
> "Shimon Sim" <(E-Mail Removed)> píše v diskusním příspěvku
> news:eggRj6O%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      01-12-2005
Whoops... nevermind...
Thought that was Request.Servervariables["URL"]

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"Jakub" <(E-Mail Removed)> wrote in message
news:emyhIDP%(E-Mail Removed)...
> Try Request.Url
>
>
> "Shimon Sim" <(E-Mail Removed)> píše v diskusním příspěvku
> news:eggRj6O%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      01-12-2005
<%@ 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" <(E-Mail Removed)> wrote in message news:eggRj6O%(E-Mail Removed)...
> 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


 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      01-12-2005
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" <(E-Mail Removed)> wrote in message news:eggRj6O%(E-Mail Removed)...
> 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
>
>

 
Reply With Quote
 
Shimon Sim
Guest
Posts: n/a
 
      01-12-2005
thanks. Request.Url has plenty info and works as expected.
What's wrong with RawUrl??
Shimon.
"Jakub" <(E-Mail Removed)> wrote in message
news:emyhIDP%(E-Mail Removed)...
> Try Request.Url
>
>
> "Shimon Sim" <(E-Mail Removed)> píše v diskusním příspěvku
> news:eggRj6O%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Shimon Sim
Guest
Posts: n/a
 
      01-12-2005
Thanks Juan
Shimon.
"Juan T. Llibre" <(E-Mail Removed)> wrote in message news:uO2ACTP%(E-Mail Removed)...
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" <(E-Mail Removed)> wrote in message news:eggRj6O%(E-Mail Removed)...
> 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
>
>

 
Reply With Quote
 
Karl Seguin
Guest
Posts: n/a
 
      01-13-2005
/me raises an eyebrow

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Juan T. Llibre" <(E-Mail Removed)> wrote in message news:uO2ACTP%(E-Mail Removed)...
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" <(E-Mail Removed)> wrote in message news:eggRj6O%(E-Mail Removed)...
> 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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN with DMZ IP address NETed to LAN IP address!!! route-map!!! examples20001@gmail.com Cisco 0 02-07-2006 04:05 PM
PIX Firewall MAC address VPN IP address Julian Dragut Cisco 1 02-07-2006 07:57 AM
obtaining the IP ADDRESS of an IP POHNE by its MAC ADDRESS ProgDario Cisco 17 05-06-2005 02:32 PM
Routing to public IP of NAT address from internal NAT address Andrew Albert Cisco 1 02-08-2005 07:05 PM
Re: Hide Address Bar or Encrypt Address?? avnrao ASP .Net 1 05-04-2004 03:46 PM



Advertisments