I have strings like:
http://127.0.0.1:22/Test
Is there some single function maybe using regular expressions that I can use to make remove the colon and port number.
It was previously suggested that I use the following but this is giving me problems if the CurrentUrl is null!
var ip = new Uri((string)Session["CurrentUrl"]);
var ipNoPort = string.Format("{0}://{1}/{2}", ip.Scheme, ip.Host, ip.PathAndQuery);
return Session["CurrentUrl"] == null ? Home() : Redirect((string)ipNoPort);
What I really need is some method that combines the three lines and checks for null also.