There is a clear difference between a soliloquy and an aside. In dramas such as Shakespeare's plays, especially "Hamlet," there are soliloquies delivered by the main characters. These are speeches given in private when the character is alone; such speeches are very revealing of the thoughts and feelings of the character. This is the purpose of the soliloquy.
An aside, however, is a line or so delivered by a character to the audience; the characters on stage do not hear what is being said, but they are present, unlike the situation involving a soliloquy.
Using "Hamlet" as an example, the Prince of Denmark, Hamlet, delivers seven different soliloquies. The most famous is his "to be, or not to be," a most introspective soliloquy in which the melancholic Hamlet wrestles with his conscience regarding the request of his father's ghost to avenge his murder. Hamlet is so depressed that he contemplates suicide, but he worries about the condemnation of his soul if he does so:
To be, or not to be, that is the question:/Whether 'tis nobler in the mind to suffer/The slings and arrows of outrageous fortune,/Or to take arms against a sea of troubles,/And by opposing end them....(III,i,56-59)
In this same play, directly before Hamlet's "to be" soliloquy Claudius delivers an aside in Act III, Scene 1 when he overhears Polonius talking to his daughter Ophelia, he feels some guilt--a guilt that he never reveals to anyone in the play--over his duplicity, and in aside that the other characters do not hear he says,
O, tis too true./How smart a lash that speech doth give my conscience!/The harlot's cheek, beautified with past'ring art,/Is not more ugly to the thing that helps it/Then is my deed to my most painted word./O heavy burden! (III,i,49-54)