Hi @NachitoMax ,
Based on your description, I think what you want to implement is to manually enter account info for authentication every time you download a file, right? Or do you just need to make sure that all files can be downloaded after once authentication?
- The first case: You may need to customize a similar modal window to enter account info for users, and then pass these info through the request(e.g. button click event) to the backend for authentication. Finally return the result.
- The second case: You just need to make sure the user is logged into the application before downloading the file. When a user tries to download a file, you can get the context of the
HttpRequest
, and determine the user's login status and return different results accordingly. For example, when the user is not logged in, just redirect to the login page.
In addition, I'm not sure the custom application
you mentioned. If it is a .NET MVC project, you could also implement your requirement via Authorize attribute. Just add it on download file action method. Something like this:
<Authorize(Roles:="Administrators")> _
Function DownladFile()
Return View()
End Function
For more details, you could refer to this doc ( for VB.NET): Authenticating Users with Forms Authentication (VB).
Of course, exactly which method you use to implement it is up to you, or your specific needs and actual situation. But if I have any misunderstanding about this issue, just let me know.
Best regards,
Xudong Peng
If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.