Magento generate url from model

All links in Magento should be generated via url model. Here is simple examples working in backend.
$url = Mage::getModel('adminhtml/url');
$url->setControllerName('adminhtml_settings');
$url->setActionName('action');
echo $url->getUrl();
This will produce full url like:
http://my-srv.com/mag/index.php/model/adminhtml_settings/action/key/6998e/
Where MODEL is model name which you are using, controller and action is generated via model and finally – if there is a existing secure key, will be created in url.