For a print document
The Artboard is page size (set in File > Document Setup)
For a web document
The page size becomes irrelevant so the artboard is made massive and a crop area is created to match the image size you initially set.
Since you can create multiple crop areas, you can easily add more design elements or mockups to your document, etc.
To change the size of the image to output select the crop area tool on the left toolbar and adjust the mask that appears.
De select any object
Go to Object – Crop area – Make.
Repeat this step again but choose Release (Object – Crop area – Release).
You will see rectangle with no stroke and no fill covering your document. All you have to do now is to click on the desired swatch (it could be a pattern, too) and you will get colored background.
You can’t set dpi so get over it. When wanting to export an image for print create it at the size you want and then use File > Export instead of save for web and devices.