Solved

c# show the output of a virtual path?

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

16 Experts available now in Live!

Get 1:1 Help Now