473,769 Members | 7,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtaining the Absolute URL of a page

I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during development.
I need the absolute url because it will be getting sent as part of an email.
Thanks.

Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Sep 8 '08 #1
13 2488
Does Request.Url help?

Kalpesh

On Sep 8, 10:50*am, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during development.
I need the absolute url because it will be getting sent as part of an email.
Thanks.

Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/
Sep 8 '08 #2
On Sep 8, 1:50*pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during development.
I need the absolute url because it will be getting sent as part of an email.
Thanks.

Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/
You can get your current absolute URL by using
Request.Url.Abs oluteUri. you will have to modify the part different
from the current relative url to the one that you want to return.

Sep 8 '08 #3
No, I am looking for a function that will get me the absolute URL of a page
other than the page I am currently on. I want to avoid the need to use
string manipulation, which would be required with anything in the Request
object. Any other ideas?

"Kalpesh" <sh*********@gm ail.comwrote in message
news:1b******** *************** ***********@z66 g2000hsc.google groups.com...
Does Request.Url help?

Kalpesh

On Sep 8, 10:50 am, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is
the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development.
I need the absolute url because it will be getting sent as part of an
email.
Thanks.

Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/

Sep 8 '08 #4
That is what I am currently doing, however, I think it would be nice to have
a method that can get me the absolute url of another page. Does such a
function exist, or will I need to write it myself? Thanks.

"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:6b******** *************** ***********@z72 g2000hsb.google groups.com...
On Sep 8, 1:50 pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is
the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development.
I need the absolute url because it will be getting sent as part of an
email.
Thanks.

Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/
You can get your current absolute URL by using
Request.Url.Abs oluteUri. you will have to modify the part different
from the current relative url to the one that you want to return.
Sep 8 '08 #5
On Sep 8, 4:06*pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
That is what I am currently doing, however, I think it would be nice to have
a method that can get me the absolute url of another page. Does such a
function exist, or will I need to write it myself? Thanks.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mac... @gmail.comwrote in
messagenews:6b* *************** *************** ***@z72g2000hsb .googlegroups.. com...
On Sep 8, 1:50 pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something suchas
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is
the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development.
I need the absolute url because it will be getting sent as part of an
email.
Thanks.
Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/

You can get your current absolute URL by using
Request.Url.Abs oluteUri. you will have to modify the part different
from the current relative url to the one that you want to return.
Why don't you post your question in the ASPNET NG?
Sep 8 '08 #6
"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:d9******** *************** ***********@73g 2000hsx.googleg roups.com...
Why don't you post your question in the ASPNET NG?
He did - he crossposts everything...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 8 '08 #7
Try ResolveUrl("~/dir/filename.asp") which will append the root path of the
domain to the virtual path regardless of where the page is requested and
compiled.

"Nathan Sokalski" <ns*******@kyle davidgroup.comw rote in message
news:Ou******** ******@TK2MSFTN GP02.phx.gbl...
>I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is
the possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development. I need the absolute url because it will be getting sent as
part of an email. Thanks.

Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Sep 8 '08 #8
I have tried that, but it only gives the path, the domain name and protocol
are not included. For example, it would return something like
/mydirectory/mypage.aspx when I am looking for
http://www.mydomain.com/mydirectory/mypage.aspx. Any other ideas?
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Hillbilly" <so******@somew here.comwrote in message
news:%2******** *******@TK2MSFT NGP06.phx.gbl.. .
Try ResolveUrl("~/dir/filename.asp") which will append the root path of
the domain to the virtual path regardless of where the page is requested
and compiled.

"Nathan Sokalski" <ns*******@kyle davidgroup.comw rote in message
news:Ou******** ******@TK2MSFTN GP02.phx.gbl...
>>I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need this
because at the moment I do not know what the domain name (or if there is
the possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development . I need the absolute url because it will be getting sent as
part of an email. Thanks.

Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Sep 8 '08 #9
In case you didn't notice, I did post it to
microsoft.publi c.dotnet.framew ork.aspnet.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Ignacio Machin ( .NET/ C# MVP )" <ig************ @gmail.comwrote in
message
news:d9******** *************** ***********@73g 2000hsx.googleg roups.com...
On Sep 8, 4:06 pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
That is what I am currently doing, however, I think it would be nice to
have
a method that can get me the absolute url of another page. Does such a
function exist, or will I need to write it myself? Thanks.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mac... @gmail.comwrote in
messagenews:6b* *************** *************** ***@z72g2000hsb .googlegroups.c om...
On Sep 8, 1:50 pm, "Nathan Sokalski" <nsokal...@kyle davidgroup.com>
wrote:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such
as
"~/mydirectory/mypage.aspx" which will return an absolute url? I need
this
because at the moment I do not know what the domain name (or if there is
the
possibility of the site going in a subdirectory) where the site will
eventually exist. Also, this will make it easier to test during
development.
I need the absolute url because it will be getting sent as part of an
email.
Thanks.
Nathan Sokalski
njsokal...@hotm ail.comhttp://www.nathansokal ski.com/

You can get your current absolute URL by using
Request.Url.Abs oluteUri. you will have to modify the part different
from the current relative url to the one that you want to return.
Why don't you post your question in the ASPNET NG?
Sep 8 '08 #10

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

Similar topics

2
5709
by: gregl | last post by:
Anyone know how to obtain the true size of the html document's body? The control contains the size that the control was set to. The body object appears to contain the same size. That information must be stored somewhere in order for the scroll bars to be enabled when the body is larger than the container. Also, I have noticed that if I initialize the control with a large size, the vertical scrollbar is disabled, but is still visible,...
3
1601
by: Sir Loin of Beef | last post by:
I have a root directory with 1 subdirectory(myphoto), and 2 files. Inside the myphoto subdirectory, I have 1 html page and another image. Root dir: <myphoto> 01.jpg watermark.php myphoto:
7
21316
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
6
1477
by: Pete | last post by:
Hi, I am writing a pre-handler page for aspx pages, in which I want to call a custom method on the code-behind class file for the aspx page. In order to do this I need to somehow get the class full namespace for the codebehind aspx page from the request absolute url that I have in the pre-handler page.
1
1845
by: Terry Mulvany | last post by:
Grettings, Normally I can use Request.RawUrl to get the 'current' page (amongst many other things). But in the case of using a Server.Transfer but the path from the root of the site . So if foo.aspx server.transfer()ed to http://www.domain.com/somefolder/bar.aspx I need '/somefolder/bar.aspx'. Thanks in advance.
12
1327
by: Nathan Sokalski | last post by:
I have a page in my site that I need the absolute url of. Is there a function in .NET to which you can pass a relative url or something such as "~/mydirectory/mypage.aspx" which will return an absolute url? I need this because at the moment I do not know what the domain name (or if there is the possibility of the site going in a subdirectory) where the site will eventually exist. Also, this will make it easier to test during development. I...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
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
9997
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
8873
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
7413
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
5309
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
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
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.