Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute EXE from ASPX

Status
Not open for further replies.

tqeonline

MIS
Joined
Oct 5, 2009
Messages
304
Location
US
I have a web server hosting a website. I want there to be a page that is able to execute a script on that server.

I created a page called "Report.aspx" that has 1 button named Button1 (for now)

here is the code i have

Code:
Imports System.Diagnostics
Partial Class Report
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim p As New Process
        p.StartInfo.FileName = "e:/Dashboard Edit/Bin/wkhtmltopdf/wkhtmltopdf.exe"

        Dim url As String = "[URL unfurl="true"]http://sqadashboard.int.asurion.com/Release_Status/Current_Releases.aspx"[/URL]
        Dim outputFile As String = "E:/Dashboard Edit/Reports/Dashboard.pdf"

        p.StartInfo.Arguments = url & " " & outputFile

        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardOutput = True
        p.StartInfo.RedirectStandardError = True
        p.StartInfo.RedirectStandardInput = True
        p.StartInfo.WorkingDirectory = "e:/Dashboard Edit/Bin/wkhtmltopdf/"
        p.Start()

        p.WaitForExit(60000)
        p.Close()

    End Sub
End Class

I click the button and there are no errors but there is also no output in the "Reports" directory.

The webpage is acting as the user for that computer.

Am i missing something?

- Matt

"If I must boast, I will boast of the things that show my weakness"

- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
 
It could be a permissions issue, I'd check with your web hosting company that you are allowed to execute this file on the server and also check that the user your website is running under actually has permissions to the folders.

Mark,

Darlington Web Design[tab]|[tab]Experts, Information, Ideas & Knowledge[tab]|[tab]ASP.NET Tips & Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top