Its very easy on a long flight, if the airline allows it, that is. I flew on JMC yesterday and did exactly what I did on the flight out. Listen at the beginning to who the Purser/CSD/Senior crew member is. Now just after one of the meal services has been completed and there are few trolleys about, go to the crew area and find the top dog. Now give them you story about your aviation interest or whatever and ask if it would be poddible to PLEASE visit the FD. If the airline allows it, this should work a treat. There are other ways but thats the one I use.
Once in the Flight Deck get to know the captain well and either pray he asks you for landing (like i did- unsuccessfully) or go for it and ask outright, you never know. As for take off, the only time I managed it was on work experience with BA and the Flight Crew already knew about me coming on. I suggest that you either write a nice letter to the appropriate person or ask at check-in/ the gate, again, be nice and polite.
BTW, we've had loads of posts on this so it may be worth searching back for something of interest.
Hope I have helped, Mark.