w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to prevent users from accessing files from URL?

Not really. Webservices are like anything else you can put on the web: When you don't want everyone in the world to access your data, don't put it on a public website.

You could have your webservice check the users Referer-header and only serve requests which originate from your website. But this header is optional and provided by the user-agent, so it can be faked by illicit users or omitted by legitimate users, so it's not a reliable way.

You could also have your webservice use authentication with username and password. That would at least restrict access to registred users and allow you to control which data each user can access. But it doesn't prevent users with login credentials from accessing the webservice without your website.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.