Long File Name problem for ASP script calling console application

krist wong 21 Reputation points
2021-03-27T05:14:50.9+00:00

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]ka8QGVG9aYKK9CZXd8D[CLJ[~IANEW9NrF]JF=OklH@LVFJOmH]JDLGV~IDG7WGPoG]KKK9\[ED]ka8QGVH=SbYK=KJZNaNI[F6ON~HLCBWHQaA]HKGKkm9OJVEFQrYKKCEZZdKH\[2mRUJRN^qNPOCKIlMQN73'.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?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,249 questions
{count} votes

Accepted answer
  1. Alberto Poblacion 1,556 Reputation points
    2021-03-27T17:51:37.48+00:00

    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.


0 additional answers

Sort by: Most helpful