I am working on an ASP.NET 3.5 web application where I need to redirect the user based in certain condition. I am currently checking the path and if it contains appropriate page say "TestPage.aspx" then generating the path using string.Format method. The code is somewhat below
Can I apply any pattern here so that there are less if-else condition and hard coding of the pages while comparison is removed?
if(string.Compare(path,"TestPage.aspx") == 0)
return string.Format(some code here...);
else if(string.Compare(path,"TestPage1.aspx") == 0)
return string.Format(another code here...);
Any help with this regard will be greatly appreciated.