View Single Post
 
Old January 19th, 2008, 12:28 PM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you are using the web application project (compiled app) then you can test the class type of the current page against that of the home page. Let's say your home page is "homepage.aspx", the codebehind class would be "homepage" so you can test it like this:

isHomePage = this.Page is homepage; // C#
   or
isHomePage = TypeOf Me.Page Is homepage 'VB

If you are using the web site project type you'll have to test the page url. I don't have VS in front of me at the moment, but it's something like this:

isHomePage = this.Page.Request.Url.ToLower().Contains("homepage .aspx"); // C#

isHomePage = Me.Page.Request.Url.ToLower().Contains("homepage.a spx") ' VB


-Peter