.net MVC:如何仅向授权用户提供静态文件 [英] .net MVC:How do I serve static files only to authorized users

查看:97
本文介绍了.net MVC:如何仅向授权用户提供静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站中有一些静态文件,例如:

There are static files in my website like:

http://myurl.com/Content/a.html

http://myurl.com/Content/b.html

...等等

我想在访问时验证用户的身份.身份验证应通过数据库的数据进行检查.

I want to verify the user's authentication when access. The authentication should be check by database's data.

我的框架:ASP.NET MVC5

My framework:ASP.NET MVC5

推荐答案

我终于通过

I finally solved this problem by this way, a important thing is I must to replace the static file's relative path with absolute path.

这篇关于.net MVC:如何仅向授权用户提供静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆