Dofactory.com
Dofactory.com
 Back to list
Views:   3.6K
Replies:  0
Archived

Question about redirecting user based on the input


Hi,

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
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...);
}
Can I apply any pattern here so that there are less if-else condition and hard coding of the pages while comparison is removed?

Any help with this regard will be greatly appreciated.

Thanks,
 
Harshad Riswadkar, Sep 20, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.