Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

File deletion issue in a VB.NET project

$
0
0
Hi,

I do have a website that is acting like a FTP site for uploads and downloads.

The workflow is:
- A user account is created
- A folder is created (kind of a home directory)
- A user logs in
- Uploads a file
- An agent logs in
- Download the file

When ever an agent logs in, there is a check for user accounts with no activity for 90+ days.

If found, the user account is deleted and the associated folder too.

THAT's where I have my problem.

1) The user is removed from the role (all good)
2) The user account is deleted (all good)
3) The files and the folder are deleted (issue: permission denied)

Looking at the file permissions in the Windows Explorer, none of the accounts listed does, indeed, have permission to delete the files.
The files to be deleted are ALL created one way or another via the website (either by upload of code behind file creation)

I Googled around and it looks like the Impersonation is the way to go for the deletion.

Now, I found this tutorial on this website but it's all in C# and my page is in VB.NET:
A complete Impersonation Demo in C#.NET[^]

I did find a VB version of the impersonation (lost the link) and when it ran, it crashed the website completely.

I now found this one:
https://code.msdn.microsoft.com/windowsapps/VBImpersonateUser-d8467be8[^]

Before I start to use this (since it's a production website), can anyone tell me if it's any good?

Or...maybe has a better idea on how to delete files created by the website that cannot be deleted by that same website.

Thanks.

Viewing all articles
Browse latest Browse all 3938

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>