this JavaScript code cannot run, and get a deny permisson . <body> <% TFile = Server.CreateObject("Scripting.FileSystemObject"); TFileStream = TFile.CreateTextFile("C:\inetpub\wwwroot\ABG\ASP\Test.txt",true); TFileStream.WriteLine("Hello World"); TFileStream.Close(); %> </body> While this VBScript code runned well : </body> <% set TestFile = Server.CreateObject("Scripting.FileSystemObject") set TFileStream = TFile.CreateTextFile("C:\inetpub\wwwroot\ABG\ASP\Test.txt",true) TFileStream.WriteLine "Hello World" TFileStream.Close %> </body> What shoul i do now so that this JavaScript code can run as same as VBScript
By default IIS executes ASP pages in the security context of a user called IUSR_machine_name. For security reasons this user has read-only access to the web root. This is why your attempt to write to a file located under web root fails. You can change permissions to allow IUSR to write in this directory, but then you will open your machine to all sorts of nasty stuff. Imagine, somebody manages to execute this script and create their own ASP page; then they will be able to read and even delete files on your machine. J.D.
J.D., john_vn said that in VBcode it's working but it is not working in JScript code. That's the problem, right? Maybe it is what Arnica said...
You wouldn't get a permission-denied message from running the wrong type of script. Usually the VBscript engine would just report the first JScript line with a semicolon as an error. May be his VBScript code isn't working after all - in the example he creates TestFile, but then actually uses TFile. J.D.