简体   繁体   中英

ASP.NET Web API : How to authorize for static HTML content

I have an ASP.net Web API 2.0 project, which exposes a REST API to be consumed by a set of static HTML pages.

The HTML pages are all static content, however they should only be served to the client after proper authorization.

What is the idiomatic way to host these HTML pages in such a way that they will only be given to authorized users?

Thanks!

Please refer following link to implement authorization for api controller.

http://www.asp.net/web-api/overview/security/authentication-filters

OR

If you are rendering html pages without any controller than create an api controller and put the authorization on that controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM