Determine name of calling page from an include file

Hello all--

I have a page let's say pageA.aspx that includes a page called pageB.aspx.

This pageB.aspx is called by most every page on the site.

I'd would like find the name of the page that calls the include pageB.aspx so that I could add conditional logic to pageB.aspx based on the name of the page that includes it. Is there an easy way to do this?

Thank you for reading my post.
LVL 46
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fritz_the_blankAuthor Commented:
In particular, I would like to do something like this on pageB.aspx:

If someCode(PageA) then
  'some code
  'different code
End if
Dave BaldwinFixer of ProblemsCommented:
Put a global variable with the name of the page at the top of every page.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fritz_the_blankAuthor Commented:
Thank you for your post. It gave me an idea that worked perfectly. On the main page, I declared a variable. On the include page, I checked to see if that variable existed. This saved me having to declare the variable on the header of each page.
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.