»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
Parsing URLFunction to Parses a URL and returns the final '.aspx' name
public static string ParseWebPage(string Web_Page_Name)
{
try
{
Web_Page_Name = Web_Page_Name.Replace("/CommAdmin/", "/").Replace("/CommAdmin_1/", "/").Replace("/CommAdmin2/", "/");
// Dimension variables to make easy references
string strLower = Web_Page_Name.ToLower();
// Cut off the protocol
if (strLower.IndexOf("http://") == 0)
Web_Page_Name = Web_Page_Name.Substring(("http://").Length);
else if (strLower.IndexOf("https://") == 0)
Web_Page_Name = Web_Page_Name.Substring(("https://").Length);
else if (strLower.IndexOf("ftp://") == 0)
Web_Page_Name = Web_Page_Name.Substring(("ftp://").Length);
// Get new string
strLower = Web_Page_Name.ToLower().Substring(Web_Page_Name.IndexOf("/") + 1);
Web_Page_Name = Web_Page_Name.Substring(Web_Page_Name.IndexOf("/") + 1);
Web_Page_Name = Web_Page_Name.Substring(0, strLower.IndexOf(".asp") + 5);
return Web_Page_Name.Replace("/", "/ ");
}
catch
{
return string.Empty;
}
}
|
|