Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»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 URL

Function 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;
}
}

Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy