Execute Script via Web

albertkohl

New member
Joined
Sep 18, 2007
Messages
1
Programming Experience
Beginner
Okay, so i have a very basic web form, were there are two check boxes, and a browse button. user inputs the file they want, hit's submit, and it uploads the file to the server.

at that point, i would like the server to execute a foxpro script, that does a bunch of data "Stuff" and thats it. when i run the site locally, it works PERFECTLY, but when i run it from an outside computer, i get a file not found error. (System.IO.FileNotFoundException: File not found.)

here's my code-behind for upload.aspx.vb:

VB.NET:
Partial Class Upload
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click

        Dim File As HttpPostedFile
        Dim saveas, filename, runcode As String
        Dim lensaveas As Int16
        Dim position As Integer
        Dim x, a As Integer
        Dim dnc, supp As String

        position = 1
        File = Request.Files.Get(0)
        saveas = File.FileName
        lensaveas = saveas.Length

        For x = 1 To lensaveas
            position = InStr(position + 1, saveas, "\")
            If position <> 0 Then
                a = position
            End If
            If position = 0 Then x = lensaveas
        Next
        position = a

        filename = File.FileName.Substring(position, lensaveas - position)
        File.SaveAs(Server.MapPath("proclosers\" & filename))
        'File.SaveAs(Server.MapPath(filename))

        dnc = chkdnc.Checked.ToString()
        supp = chksupp.Checked.ToString()

        If dnc = "True" Then dnc = "Y" Else dnc = "N"
        If supp = "True" Then supp = "Y" Else supp = "N"

        filename = File.FileName.Substring(position, lensaveas - position - 4)
        runcode = "vfp9 \Inetpub\wwwroot\RUAccountable\proclosers\processing " & filename & " " & dnc & " " & supp
        Shell(runcode, vbNormalFocus)

        'for debugging:
        output.Text = runcode

    End Sub
End Class


I'm totally a beginner when it comes to vb.net and asp, so please dont crusify me :eek:) any help, or direction will be greatly appreciated, and if you think i'm going all about this, please feel free to chime in. not looking for someone to write this for me, just point me in the right direction!

THANKS!
 
Last edited:
Back
Top