How to have pop up to enter credentials while accessing a restrictive folder?

When accessing a restrictive folder, sometimes it will pop up for you to enter credentials but sometimes it will simply give you an error message saying "Windows cannot access this folder..... You don't have permission...."

Question to you, if this folder is what I don't have a proper permission how to surely have a popup allowing entering credentials rather than an error message without the ability to enter credentials?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is how it works:
If you are using a local user and you try to access a domain based share, you will be asked for credentials at all times. Exception: if you have saved credentials in your windows vault OR if you have already connected a network drive with domain user credentials to that very server, it will not ask, but try and use these.

If however you are using a domain user on that very domain, your credentials will be tried and if access is denied, no credential popup but an access-denied-message will appear. Exception to the rule: if you access an administrative share like \\server\c$, you will be asked for administrative credentials at all times, unless your account is already admin on the remote machine.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.