Solved

c# show the output of a virtual path?

Posted on 2011-02-21
2
476 Views
Last Modified: 2013-12-17
hi all,

im trying to find out the exact url of <%@ PreviousPageType VirtualPath="~/Companies/test.aspx"  %>

how can i output the above in path format, i.e
i want it to show where that leads. http://website.com/Companes/test.aspx

i need to know what the ~ path is from this page

Thanks

0
Comment
Question by:awilderbeast
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34942468
The tilda just means "from site root" so will only give you a relative path even when resolved. If you want the full path then you will need to strip the domain information from the Request object.
string path = "~/Companies/test.aspx";
string url = string.Format("{0}://{1}{2}",
                         Request.Url.Scheme,
                         Request.Url.Authority,
                         ResolveUrl(path));

Open in new window

0
 
LVL 1

Author Closing Comment

by:awilderbeast
ID: 34942512
thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now