Is this the easiest way to Convert an ASP.Net Virtual Path to a URI?(blueonionsoftware.com)

submitted by blueonionblueonion(150) 3 years, 5 months ago

ASP.Net has a boat load of methods for dealing with paths. However, no where can I find a method to convert a virtual path (~/) to its equivalent Uri. Perhaps it’s there but darn if I can find it. The best I can up with is: var uri = Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/SomePage.aspx"); If the site is hosted at: http://example.com/website, then this code yields http://example.com/website/SomePage.aspx, which is what I want. Perhaps there is a better way to do this?

add a comment |category: |Views: 10

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story