views:

121

answers:

1

I have an existing application that was written in .NET 3.5. The piece of code in question is using the FileUpload control and its SaveAs method. Its worked perfectly for the past six months, but I've recently upgraded the project to .NET 4.0 and I'm now receiving an "Access to path (...) is denied" every time the method is called. It works fine locally in dev mode but fails on my prod server. I've upgraded the website to run under .NET 4.0 and I've made sure the account (Network Service) it runs under in the app pool has full control. Other than upgrading to .NET 4.0, nothing has changed for the project. Any ideas or suggestions? Thanks in advance.

A: 

First, what I would do is double-check that this is really a permissions issue by (TEMPORARILY) granting "Everyone" access to that path. Run a quick test... if it works, you're definitely looking at a permissions issue.

Next, look at the exception in EventViewer and it should tell you the user identity that is attempting to write the file. If that doesn't work, you can use FileMon to see a log of the attempt and definitely get the info you need from that.

These issues are a pain in the ass, and 99% of the issue is that Microsoft changes the way this works in every IIS or .NET update. If it was just consistent from version to version, this would never crop up.

Bryan