Code for Category, Tags, Archive URLs

in a category archive, the code could be:

echo get_category_link(get_query_var('cat')); 

in a tag archive, this could be:

if(is_tag()) echo get_term_link(get_query_var('tag'), 'post_tag');

the conditional was added to avoid an error messages if not in a tag archive.