In a C# 2010 application, I have a string value that looks like the following:
"http://localhost:99/test/TestHome.aspx". I only want to obtain the part of the string that is "TestHome.aspx".
I have tried lots of string functions to obtain the "TestHome.aspx" part of the string with no success yet.
Thus can you tell me how to obtain the part of the string I am trying to access?
Loading
Posted Jun 21, 2012, 7:00 PM
string pageurl = "http://localhost:99/test/TestHome.aspx";
var idx = pageurl.LastIndexOf("/");
string pagename = pageurl.Substring(idx+1);
Sumit GaudPosted Jun 22, 2012, 5:55 AM
string s= Path.GetFileName("http://localhost:99/test/TestHome.aspx ");