Solved

c# show the output of a virtual path?

Posted on 2011-02-21
2
478 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

837 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