Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

wscript.shell not working in asp..help

Last post 07-11-2008 11:00 AM by Veritant. 19 replies.
Page 2 of 2 (20 items) < Previous 1 2
Sort Posts: Previous Next
  • 07-09-2008 8:25 PM In reply to

    • Veritant
    • Top 50 Contributor
    • Joined on 11-02-2001
    • United Kingdom
    • Guru
    • Points 1,975

    Permissions on the subfolder

    Looks to me like you need to allow script and/or executable permission on the "business_subjects" subfolder. You should be able to do this in IIS (right-click on the folder in IIS and choose properties). If you allow executable permission, then don't allow write permission on the same folder, as this opens a potential opportunity for someone to write an executable to the folder and run it.

    Veritant (John)
    • Post Points: 10
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 07-09-2008 8:45 PM In reply to

    • jonpfl
    • Not Ranked
    • Joined on 07-09-2008
    • United States
    • New Member
    • Points 60

    Re: Permissions on the subfolder

    Veritant:

    Looks to me like you need to allow script and/or executable permission on the "business_subjects" subfolder. You should be able to do this in IIS (right-click on the folder in IIS and choose properties). If you allow executable permission, then don't allow write permission on the same folder, as this opens a potential opportunity for someone to write an executable to the folder and run it.



    Ok, I finally got it working.  I got the Admin guy at our work to give read/execute permission to cscript.exe in the windows/system32 directory.

    Now that I got that working, I am having problems with the script actually doing anything.  If I double click the script from the server, a PDF file gets created w/o a problem.  If I actually execute the script via an ASP page, it says it runs successfully but no file gets created.

    What should I look at now?  Sorry for bothering you so much but I am still learning.

    Thx
    jonpfl

    • Post Points: 10
  • 07-09-2008 10:38 PM In reply to

    • Veritant
    • Top 50 Contributor
    • Joined on 11-02-2001
    • United Kingdom
    • Guru
    • Points 1,975

    Re: Permissions on the subfolder

    I think the most likely problem is, again, permissions on folders - this time write permission for the pdf file. When you run the script yourself it will be run with your own user id's permissions, and you have the necessary permission to write to the folder. When it is run from the asp page, the user will probably be whatever has been set up in IIS as the user account for anonymous access (I think this is by default something like IUSR_<server name>). It is likely that this user does not have write permissions on the folder to which the application is trying to write the pdf.

    Another possibility: I think when you double-click on a vbs script, the default is to use wscript, not cscript. There may be some difference between these when running your script. Is there any input required to the script when it is run that it may be failing on?

    Veritant (John)
    • Post Points: 10
  • 07-10-2008 12:34 PM In reply to

    • jonpfl
    • Not Ranked
    • Joined on 07-09-2008
    • United States
    • New Member
    • Points 60

    Re: Permissions on the subfolder

    I took some of my code out and now I am getting the following error :

    Microsoft VBScript runtime error '800a0046'

    Permission denied

    /credit_reporting/maintenance/business_subjects/jon.asp, line 11

    1. <%@ Language=VBScript %>
    2. <% Option Explicit %>
    3.  
    4. <%
    5. Dim WSHShell, sTemp
    6. Set WSHShell = CreateObject("WScript.Shell")
    7.  
    8. sTemp = "cscript " & server.MapPath("\credit_reporting\maintenance\business_subjects\jo  n_email.vbs") & ", 2, true"
    9. 'WSHShell.Run server.MapPath("\credit_reporting\maintenance\business_subjects\jo  n_test.vbs"), 1, true
    10. 'WSHShell.Run "cscript cmd /c echo hi > c:\temp\test.txt" , 0, TRUE
    11. WSHShell.Run sTemp
    12. %>
    13.  
    14. <html xmlns="http://www.w3.org/1999/xhtml">
    15.  
    16.     <head>
    17.         <title>jon</title>
    18.     </head>
    19.  
    20. <body onload="">
    21. <table width="100%">
    22.     <tr><td>test</td></tr>
    23. </table>
    24.  
    25. </body>
    26. </html>


    Here is jon_email.vbs
     
    1. dim Mail
    2. set Mail = CreateObject("CDO.Message")
    3.  
    4. 'fill email fields
    5. Mail.From= "jonp@tampabay.rr.com"
    6. Mail.To= "jpessano@nacmtampa.com"
    7. Mail.Subject="test"
    8. Mail.TextBody="test"
    9.  
    10. Mail.Send  'email this message
    11.  
    12. set Mail = Nothing


    This is getting really frustrating. I have gone on the server and given Read/Execute permission for IUSR_.... for wscript.exe, cscript.exe, jon.asp, jon_email.vbs and cdosys.dll. What else could it be???

    Thx
    jonpfl
    • Post Points: 10
  • 07-11-2008 11:00 AM In reply to

    • Veritant
    • Top 50 Contributor
    • Joined on 11-02-2001
    • United Kingdom
    • Guru
    • Points 1,975

    Step by step

    There's still a permission problem somewhere. Some suggestions...

    1. Try putting the email code directly in the asp page, and see if it runs OK. As a matter of interest, why are you running it in a separate shell anyway?

    2. Have you allowed script & executable permission on the \credit_reporting\maintenance\business_subjects (virtual) folder within IIS itself?

    3. I thought you would have to set the SMTP server address, email account name and email account password as parameters on the Message object before you can send?

    Veritant (John)
    • Post Points: 5
Page 2 of 2 (20 items) < Previous 1 2