?
Solved

c# show the output of a virtual path?

Posted on 2011-02-21
2
Medium Priority
?
481 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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