views:

114

answers:

2

Hi,

I am having problems downloading files possibly due to the file extensions not matching the actual file. What is happening is the File.Exists check is returning false for these even though the named file does exist. Is anybody aware of anything in IIS or even IE which would cause this. I have seen this with .txt, .exe. and .avi files. The .avi works of as long as the file really is an avi and not renamed from something else.

Please advise any knowledge on this subject.

Thank you,

James

A: 

Are you doing this within server-side ASP.NET code? If so, you may need to use Server.MapPath or assign the appropriate permissions to be able to access the file's directory.

Please submit code to show what you're trying to do.

David Andres
Please see my other post at: http://stackoverflow.com/questions/1384649/how-to-retrive-and-download-server-files-file-exists-and-urlYes, server side code
James
What I am doing is building a list of URL's which I pass to an ActiveX download control. But I am getting file does not exist on all my test files except for a couple .avi's
James
Are all of these files within the same directory? In any case, check your permissions. Make sure the ASPNET user has access to the folders you're trying to retrieve files from.
David Andres
Yes, All are in the same folder so I would think since the .avi files are working that permissions must be ok. I will check. Thanks
James
The folder has full permissions so that isn't it....
James
Bear in mind that the Everyone user does not include ASPNET, so you'll need to give that user permissions separately. Once done, you can view Effective Permissions on the "missing" files to see if ASPNET can access it. Also, what OS is the server running against, and does it differ from your local environment?
David Andres
also...make doubly sure that there's nothing added/removed from the file names that are being passed to File.Exists...
David Andres
See my new post for what the problem is.http://stackoverflow.com/questions/1386338/why-is-fileinfo-showing-an-extra-file-extension
James
+1  A: 

Ok, we have an answer.... I actually had double file extensions on the files that were not working but the option to hide known extensions was turned on (I guess by default). The .avi files looked the same as the others so I guess it was considering .avi to be an "unknown" file type. Whatever!

The answer is on my other post here:

http://stackoverflow.com/questions/1386338/why-is-fileinfo-showing-an-extra-file-extension

Thanks, James

James