This happened to a friend of mine. Actually no one ever told her. My friend and her husband were doing some genetic testing because all three of their children were born with a rare (I believe) genetic condition that wasn't showing up on either side of the family. Both my friend and her "father" took a DNA test and that's how she found out that the man she believed to be her father all her life really was not her father. Because this is a sensitive issue, I never asked my friend any intrusive questions (we are friends but not best friends) but she seems to have handled this new information with a sense of humor, which is the way she handles most everything.
As for me, I've always known who my father is but have had no relationship with him or that side of the family since I was 3. Because I have had some mysterious health concerns crop up (possibly from my father's side of the family but, who knows?) and because of my friend's experience with her children's genetic health concerns, I do believe it should be a child's inherit right to have access to the full scope of their medical history regardless of whether his/her parents stay together or not.
As for how do you handle this sort of news (secret), all I can suggest is to take the good stuff and the good memories that you have and learn from the stuff that was not necessarily in your best interest. It seems to be human nature for people to make decisions or behave in a way that is short-sighted or not in someone else's best interest. I think that shame and the inability to look at yourself honestly has a lot to do with this. But I'm sure that there are a number of different reasons why this situation may occur.
I hope that, whatever you are dealing with, it all turns out well. Sending prayers of healing and clarity your way.