Click here to Skip to main content
15,747,356 members
Please Sign up or sign in to vote.
4.11/5 (2 votes)
See more:
I have mentioned below that i want. Ex.2 is urgent:

input string :
output url :

input string :
output url :

Thanks in advance.

Emon Mahmud
Updated 16-Feb-14 21:46pm
Ankur\m/ 17-Feb-14 3:52am    
If it's a web application, check out your Request object. And if it is not, you can either use regular expression or simple string operations to the get the value.

check url with regex format and if it is not valid then add http or https at started of string ... u will get path of it
Share this answer
if Real URL:

url = HttpContext.Current.Request.Url.AbsoluteUri;

string path = HttpContext.Current.Request.Url.AbsolutePath;
// /horse

string host = HttpContext.Current.Request.Url.Host;
Share this answer
Emon Mahmud 17-Feb-14 4:04am    
We don't bother about real/fake URL. I want just out put string
Roozbeh Maheronnaghsh 17-Feb-14 4:09am    
What do u mean by output string.Explain more please.URL is string also

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900