Click here to Skip to main content
12,394,978 members (67,094 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

4.7K views
2 bookmarked
Posted

Turning local paths from an HTML code in external accessible paths

, 20 Feb 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Turning local paths from an HTML code in external accessible paths
Let's say you have a project where you coded some stuff to get all links (href) from a webpage (html) but the links are all local paths like /pages/download.php

The code provided below is an simple example on how to turn these into a full path with only needing 3 lines of code and a url.

The code below is pretty easy and short but works great.
var Url = new Uri("http://website.com/");
var newurl = new Uri(Url, "/path/download.php");
string path = newurl.ToString();

Edit
Another solution to this problem submitted by: DaveAuld
Thank you Smile | :)
String fullurl = new Uri(new Uri("http://website.com"), "/path/download.php").ToString();

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

McPhantom
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralEdit: fixed spelling..... Pin
DaveAuld20-Feb-11 2:35
mentorDaveAuld20-Feb-11 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160721.1 | Last Updated 20 Feb 2011
Article Copyright 2011 by McPhantom
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid