Solution 1:

It is not so much about grammar as politeness. It sounds a bit more polite to use 'may', rather than 'can', but as long as you say 'please' it doesn't much matter.

Solution 2:

In both the sentences you mention, both "can" and "may" are grammatically correct. This is because grammar does not concern itself with the meanings of words or sentences. What I suspect you're having trouble with is the etiquette and semantic meanings of those particular formulations, which are better explained here.