Repost: Save file on Server - with a twist.

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Repost: Save file on Server - with a twist.

    Hi All,

    I am reposting this because I need some guidance/advice fairly quickly.

    I currently have the following setup for saving a file on the server:

    The user runs a VB app on his/her PC. Among other things, the app
    prompts the user to select a file (or files). The app then uploads the
    file(s) to the web server (effectively pushing the files up). In addition,
    the app calls an aspx page and passes the file name (and a few other
    bits of data) to the page as query strings. The page then writes the
    data to the database. But the user never sees the page - it all happens
    "behind the scenes".

    Here is what I want to do:

    I want to modify the aspx so it pulls the file from the client, as well as
    the other things it currently does. The VB app would simply pass all the
    relevant info to the page, and the page would do all the work. To prevent
    someone calling the page without using the VB app, the app passes an
    encrypted string that the page uses to verify that the page has been called
    legitimately.

    I know I can do this very easily by using a HTML <input type="file">
    control. But I don't want to do this because I don't want the user to
    ever see the page - the user still needs to use the VB app, I just want
    to shift control of the file transfer from the app to the aspx page.

    If this presents a security risk, or if it can't be done, I would be
    grateful
    if someone could explain why.

    Cheers,

    MG


    Mr Gordonz Guest

  2. Similar Questions and Discussions

    1. file permissions - ack! - REPOST
      > *** Chris Fortune wrote (Fri, 06 Aug 2004 07:47:08 GMT): Here is the contents of /home/joe/.bogofilter drwxrwxrwx 219 joe joe 4096...
    2. multi-file upload with a twist
      I'm looking for a PHP script that supports multi-file upload. However, because my users could potentially be uploading hundreds of files, the...
    3. [Repost :Forms] Simple load save data from FDF /TXT file
      Hello, I'm new of Acrobat, I've purchased Acrobat 6 pro. No one asnwer my previous post, then I repost whith hope to have any help :-) I must...
    4. Web Services vs SQl Server Replication (repost)
      Reposted as I didn't use my Microsoft-provided posting address ... I'm interested on any opinions people have. If I have a .net rich-client app...
    5. Save a file on the Server from Client
      Hi All, I want to be able to save a file from the client's PC on the server. The tricky part is the aspx page is never actually seen by the...
  3. #2

    Default Re: Repost: Save file on Server - with a twist.

    Hi,

    I would recommend using a Web Services instead of an ASPX page. You can
    easily call your own web service with all the parameters and the file data
    from your VB app, at least if you use VB.NET. If you still use VB6, then the
    ASPX way may be easier. In this case you still have to use <input
    type=file...>, but you can implement the page so that it only allows POSTs
    (PageLoad: if(IsPostBack==false) Response.End() or something similar like
    that).

    Best regards,

    Marc Höppner
    NeoGeo

    "Mr Gordonz" <paul@mobius.net.au> wrote in message
    news:OVnua9KXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > Hi All,
    >
    > I am reposting this because I need some guidance/advice fairly quickly.
    >
    > I currently have the following setup for saving a file on the server:
    >
    > The user runs a VB app on his/her PC. Among other things, the app
    > prompts the user to select a file (or files). The app then uploads the
    > file(s) to the web server (effectively pushing the files up). In
    addition,
    > the app calls an aspx page and passes the file name (and a few other
    > bits of data) to the page as query strings. The page then writes the
    > data to the database. But the user never sees the page - it all happens
    > "behind the scenes".
    >
    > Here is what I want to do:
    >
    > I want to modify the aspx so it pulls the file from the client, as well as
    > the other things it currently does. The VB app would simply pass all the
    > relevant info to the page, and the page would do all the work. To prevent
    > someone calling the page without using the VB app, the app passes an
    > encrypted string that the page uses to verify that the page has been
    called
    > legitimately.
    >
    > I know I can do this very easily by using a HTML <input type="file">
    > control. But I don't want to do this because I don't want the user to
    > ever see the page - the user still needs to use the VB app, I just want
    > to shift control of the file transfer from the app to the aspx page.
    >
    > If this presents a security risk, or if it can't be done, I would be
    > grateful
    > if someone could explain why.
    >
    > Cheers,
    >
    > MG
    >
    >

    Marc Hoeppner Guest

  4. #3

    Default Re: Repost: Save file on Server - with a twist.

    Hi Marc,

    The VB app is indeed VB6, and I have never created a Web Service. I did
    actually try the following in the pageload event of the page:

    1. Dim txtFilePath As String = Trim(Request.QueryString("FilePath"))
    2. Dim myControl As HtmlControls.HtmlInputFile = New
    HtmlControls.HtmlInputFile()
    3. myControl.Value = txtFilePath
    4. Dim strFileName = myControl.PostedFile.FileName
    5. myControl.PostedFile.SaveAs(strServerPath & "\media\" & strFileName)

    But it didn't like line 3 - the error I got is: Object reference not set to
    an instance of an object.

    How can I use a <input type=file> control if it is never seen by the user?
    I have done a lot research into how this control works, and everything I
    have read says that the value property of the control can't be set
    programmatically (for security reasons). There must be a way for a page to
    pull a file off a client computer without the user having to actually see
    the page??

    Cheers,

    MG



    "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
    news:%23WCDujLXDHA.1580@tk2msftngp13.phx.gbl...
    Hi,

    I would recommend using a Web Services instead of an ASPX page. You can
    easily call your own web service with all the parameters and the file data
    from your VB app, at least if you use VB.NET. If you still use VB6, then the
    ASPX way may be easier. In this case you still have to use <input
    type=file...>, but you can implement the page so that it only allows POSTs
    (PageLoad: if(IsPostBack==false) Response.End() or something similar like
    that).

    Best regards,

    Marc Höppner
    NeoGeo

    "Mr Gordonz" <paul@mobius.net.au> wrote in message
    news:OVnua9KXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > Hi All,
    >
    > I am reposting this because I need some guidance/advice fairly quickly.
    >
    > I currently have the following setup for saving a file on the server:
    >
    > The user runs a VB app on his/her PC. Among other things, the app
    > prompts the user to select a file (or files). The app then uploads the
    > file(s) to the web server (effectively pushing the files up). In
    addition,
    > the app calls an aspx page and passes the file name (and a few other
    > bits of data) to the page as query strings. The page then writes the
    > data to the database. But the user never sees the page - it all happens
    > "behind the scenes".
    >
    > Here is what I want to do:
    >
    > I want to modify the aspx so it pulls the file from the client, as well as
    > the other things it currently does. The VB app would simply pass all the
    > relevant info to the page, and the page would do all the work. To prevent
    > someone calling the page without using the VB app, the app passes an
    > encrypted string that the page uses to verify that the page has been
    called
    > legitimately.
    >
    > I know I can do this very easily by using a HTML <input type="file">
    > control. But I don't want to do this because I don't want the user to
    > ever see the page - the user still needs to use the VB app, I just want
    > to shift control of the file transfer from the app to the aspx page.
    >
    > If this presents a security risk, or if it can't be done, I would be
    > grateful
    > if someone could explain why.
    >
    > Cheers,
    >
    > MG
    >
    >

    Mr Gordonz Guest

  5. #4

    Default Re: Repost: Save file on Server - with a twist.

    Why first request an empty page?
    You don't want to GET an empty page, you want to POST a filled page.
    See if you can work out how the "browser" response is encoded
    and send that (filename, other bits, file data).

    Hans Kesting


    "Mr Gordonz" <paul@mobius.net.au> wrote in message
    news:uPBQa0LXDHA.2360@TK2MSFTNGP12.phx.gbl...
    > Hi Marc,
    >
    > The VB app is indeed VB6, and I have never created a Web Service. I did
    > actually try the following in the pageload event of the page:
    >
    > 1. Dim txtFilePath As String = Trim(Request.QueryString("FilePath"))
    > 2. Dim myControl As HtmlControls.HtmlInputFile = New
    > HtmlControls.HtmlInputFile()
    > 3. myControl.Value = txtFilePath
    > 4. Dim strFileName = myControl.PostedFile.FileName
    > 5. myControl.PostedFile.SaveAs(strServerPath & "\media\" & strFileName)
    >
    > But it didn't like line 3 - the error I got is: Object reference not set
    to
    > an instance of an object.
    >
    > How can I use a <input type=file> control if it is never seen by the user?
    > I have done a lot research into how this control works, and everything I
    > have read says that the value property of the control can't be set
    > programmatically (for security reasons). There must be a way for a page
    to
    > pull a file off a client computer without the user having to actually see
    > the page??
    >
    > Cheers,
    >
    > MG
    >
    >
    >
    > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
    > news:%23WCDujLXDHA.1580@tk2msftngp13.phx.gbl...
    > Hi,
    >
    > I would recommend using a Web Services instead of an ASPX page. You can
    > easily call your own web service with all the parameters and the file data
    > from your VB app, at least if you use VB.NET. If you still use VB6, then
    the
    > ASPX way may be easier. In this case you still have to use <input
    > type=file...>, but you can implement the page so that it only allows POSTs
    > (PageLoad: if(IsPostBack==false) Response.End() or something similar like
    > that).
    >
    > Best regards,
    >
    > Marc Höppner
    > NeoGeo
    >
    > "Mr Gordonz" <paul@mobius.net.au> wrote in message
    > news:OVnua9KXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > > Hi All,
    > >
    > > I am reposting this because I need some guidance/advice fairly quickly.
    > >
    > > I currently have the following setup for saving a file on the server:
    > >
    > > The user runs a VB app on his/her PC. Among other things, the app
    > > prompts the user to select a file (or files). The app then uploads the
    > > file(s) to the web server (effectively pushing the files up). In
    > addition,
    > > the app calls an aspx page and passes the file name (and a few other
    > > bits of data) to the page as query strings. The page then writes the
    > > data to the database. But the user never sees the page - it all happens
    > > "behind the scenes".
    > >
    > > Here is what I want to do:
    > >
    > > I want to modify the aspx so it pulls the file from the client, as well
    as
    > > the other things it currently does. The VB app would simply pass all
    the
    > > relevant info to the page, and the page would do all the work. To
    prevent
    > > someone calling the page without using the VB app, the app passes an
    > > encrypted string that the page uses to verify that the page has been
    > called
    > > legitimately.
    > >
    > > I know I can do this very easily by using a HTML <input type="file">
    > > control. But I don't want to do this because I don't want the user to
    > > ever see the page - the user still needs to use the VB app, I just want
    > > to shift control of the file transfer from the app to the aspx page.
    > >
    > > If this presents a security risk, or if it can't be done, I would be
    > > grateful
    > > if someone could explain why.
    > >
    > > Cheers,
    > >
    > > MG
    > >
    > >
    >
    >

    Hans Kesting Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139