This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Showing posts with label Dotnet code for url parsing. Show all posts
Showing posts with label Dotnet code for url parsing. Show all posts

Sunday, November 2, 2008

Parsing URL(ASP.NET CODE)

Parsing URL
Function to Parses a URL and returns the final '.aspx' name

CODE:
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;
}
}

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger