question

kristwong-4987 avatar image
0 Votes"
kristwong-4987 asked kristwong-4987 commented

Long File Name problem for ASP script calling console application

I have developed a console application using C# for encrypting and decrypting a file and filename. It works properly in windows. However, when I call it from Classic ASP vbscript using WScript.Shell, it failed. The calling was with a very long file name such as "encodefile.exe -i ""c:\16T\Chinese[ED]Oc'3~6'=F^6C~BF8F^-A@)[ED]ka8QGVG9`aYKK9CZXd8D[CLJ[~IANEW9NrF]JF=OklH@LVFJOmH]JDLGV~IDG7WGPoG]KKK9[ED]ka8QGVH=SbYK=KJZNaNI[F6ON~HLCBWHQaA]HKGKkm9OJVEFQrYKKCEZZdKH[2mRUJRN^qNPOCKI`lMQN73'.ec"" -decrypt" When I run the exact parameter in command line, it works properly, but when I run it in ASP script, it return error and the debug message shown "File Not found" when running File.Exists(filename); Any clue?

dotnet-csharp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Did you check the error or exception details if you assume that the file exists and remove ‘If File.Exists(filename)’?

0 Votes 0 ·

1 Answer

APoblacion avatar image
0 Votes"
APoblacion answered kristwong-4987 commented

Have you checked the permissions on the file? When it is accessed from the ASP application it will be accessed with the permissions of the account for the IIS Pool that's running the application (not the permissions of the user who is invoking the application from a browser). However, when you run it from the command line it uses your own user account, which may well have very different permissions on the file or its containing folder.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes, I need to add IIS_IUSRS permissions to all the files involved.

Thanks

0 Votes 0 ·