开发者

file download with authentication in asp.net

开发者 https://www.devze.com 2023-02-10 16:21 出处:网络
suppose i have hyperlink in my pages and which point to zip file. when user click on the link then i want that file will not download if the user is not logged in. if the user already logged in then f

suppose i have hyperlink in my pages and which point to zip file. when user click on the link then i want that file will not download if the user is not logged in. if the user already logged in then file will be download. i want to implement this type of security with th开发者_StackOverflow社区e help of form authentication. so just tell me what i need to and what kind of setting i need to have in my web.config file. please help me in detail with code sample.

thanks


By adding this inside <system.web>

<authorization>
    <deny users="?" />
</authorization>

in a web.config that is located in the folder where the file is, will prevent users that are anonymous to access files in the folder.

You can read about "HOW TO: Control Authorization Permissions in an ASP.NET Application" over att Microsoft Support.

0

精彩评论

暂无评论...
验证码 换一张
取 消