We know Aragorn eventually found Gollum in the Dead Marshes, I was just wondering if either of them had actually dared to venture into Mordor, to maybe learn some of Saurons secrets.
There is evidence that Aragorn may have done so.
When he served the Steward Ecthelion (father of Denethor) under the assumed name Thorongil, his final act was an assault by sea on Umbar; on his return he did not go back to Gondor but instead (from Lord of the Rings Appendix A, Gondor and the heirs of Anárion):
... when they came back to Pelargir, to men's grief and wonder, he would not return to Minas Tirith, where great honour awaited him.
He sent a message of farewell to Ecthelion, saying: "Other tasks now call me, lord, and much time and many perils must pass, ere I come again to Gondor, if that be my fate." Though none could guess what those tasks might be, nor what summons he had received, it was known whither he went. For he took boat and crossed over Anduin, and there he said farewell to his companions and went on alone; and when he was last seen his face was towards the Mountains of Shadow.
Cross-checking with the Tale of Years (Appendix B) we see that his service as Thorongil occurred during the years Third Age 2957 to 2980; now, when we read the Tale of Aragorn and Arwen (Appendix A), we see:
It came to pass that when Aragorn was nine and forty years of age he returned from perils on the dark confines of Mordor, where Sauron now dwelt again and was busy with evil.
Now, the Tale of Years states that Aragorn was born in 2931, and 2980 less 2931 is 49, so this event is an obvious reference to what happened after he had finished his service in Gondor as Thorongil.
This is not, it must be emphasised, hard evidence that Aragorn was actually in Mordor; "confines" in this context means "borders", but it is the closest that we have and it is entirely possible that he did enter (it is equally as possible that he did not).
There is no evidence that I aware of concerning whether or not Gandalf had ever entered Mordor.
Despite all of this, and even if one or both of them had entered Mordor, neither of them would have explored it to any great length; it is absolutely certain that neither had visited Barad-dûr on account of Gandalf's words in A Journey in the Dark:
'You speak of what you do not know, when you liken Moria to the stronghold of Sauron,' answered Gandalf. 'I alone of you have ever been in the dungeons of the Dark Lord, and only in his older and lesser dwelling in Dol Guldur. Those who pass the gates of Barad-dûr do not return.
During the council of Elrond, Aragorn waves off any discussion of the perils of his search for Gollum with this statement:
There is little need to tell of them. If a man must needs walk in sight of the Black Gate, or tread the deadly flowers of Morgul Vale, then perils he will have.
It sounds like he got really close to Mordor, but didn't try to get in.