473,385 Members | 1,798 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,385 software developers and data experts.

Virtual Path "~/" to full Uri

I need to take a path "~/" and get a http://localhost:port/rootappfolder/
url out of it.

Currently I'm using:
Request.Url.Scheme + "://" + Request.Url.Host + this.ResolveUrl("~/");
//this is run from the context of a user control.

Is this the best way to do this by rebuilding the url from the client
request?

ideas?

Thanks in advance,
Nathan
Sep 20 '07 #1
2 5082
Assuming that the scheme is always going to be "http://" you don't need to
get that from the Request.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Nathan" <na*****@vinsolutions.comwrote in message
news:ec****************@TK2MSFTNGP02.phx.gbl...
>I need to take a path "~/" and get a http://localhost:port/rootappfolder/
url out of it.

Currently I'm using:
Request.Url.Scheme + "://" + Request.Url.Host + this.ResolveUrl("~/");
//this is run from the context of a user control.

Is this the best way to do this by rebuilding the url from the client
request?

ideas?

Thanks in advance,
Nathan

Sep 21 '07 #2
Yeah, I actually ended up using:
Request.Url.Scheme + "://" + Request.Url.Host + ":" +
Request.Url.Port.ToString() + this.ResolveUrl("~/")

I'm trying to make my app portable between dev and production without having
to worry about the path. It's also being generated in a PDF, so I needed to
be able to have a fully qualified path for the link so it could be accessed
from the client directly.

Thanks
"Kevin Spencer" <un**********@nothinks.comwrote in message
news:ee*************@TK2MSFTNGP06.phx.gbl...
Assuming that the scheme is always going to be "http://" you don't need to
get that from the Request.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Nathan" <na*****@vinsolutions.comwrote in message
news:ec****************@TK2MSFTNGP02.phx.gbl...
>>I need to take a path "~/" and get a http://localhost:port/rootappfolder/
url out of it.

Currently I'm using:
Request.Url.Scheme + "://" + Request.Url.Host + this.ResolveUrl("~/");
//this is run from the context of a user control.

Is this the best way to do this by rebuilding the url from the client
request?

ideas?

Thanks in advance,
Nathan


Sep 21 '07 #3

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

Similar topics

3
by: Mark Urish | last post by:
I want to make sure that a filename is an "absolute path" (ie. has a drive spec. and root, or else is a UNC path) if it isn't already one. Path.GetFullPath seems to do the trick, except there is...
6
by: kelvSYC | last post by:
This little bit of seeminly innocent code seems to give me these two errors, all on the line that declares check(). Is there some part of C++ that I'm missing out on? class Condition { public:...
8
by: And | last post by:
Hi everyone my database is in a folder inside the inetpub folder (c:\inetpub\bd\mydatabase.mdb) and my web application is in a folder inside the wwwroot folder. My question is: Is there a way...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
1
by: Dave | last post by:
I am getting te following error in a ASP.Net app that is running on Win XP Pro (SP2): Server cannot access application directory 'C:\Documents and Settings\dave\My Documents\My Visual Studio...
2
by: ABC | last post by:
How to return the full virtual path if I pass the url as "~/default.aspx"? I expected this should result as http://aaa.bbb.com/default.aspx.
2
by: cmay | last post by:
I have a web application that I want to run using the "ASP.NET Development Server" when I am working locally. When I go to do this however, I don't see an option to set the Virtual Path. By...
4
by: tommaso.gastaldi | last post by:
Hi friends I was in the need to find a sort of "definitive" :) solution to transform a virtual path such as "~/MyDir/MyFile into a full web address. In particular I needed it * within web...
9
by: larrybud2002 | last post by:
I've read about this error in this group and others from early 2006 but without any resolution, so I thought I'd bump it up to see if there's a solution. Trying to build a website on ...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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
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,...
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...

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.