asp.net form to send a request to a put request

Discussion in 'Microsoft ASP .NET' started by Guest, Oct 29, 2004.

  1. Guest

    Guest Guest

    I have a web page I need to post a file plus some other fields to it. How
    can I do this from a asp.net page. I know I can send individual fields to the
    other page, but how do I send a file to the other page, or is there something
    else like a stream which will be like a file. I am attempting to get a way
    from writing out a file and then having to give the page that I am posting to
    the file name. Instead I would like to just from asp.net post to the other
    HTML page, the information, plus this file without writing a file out first.
     
    Guest, Oct 29, 2004
    #1
    1. Advertisements

  2. You would do this exactly the same as you would do it in regular HTML
    without ASP.NET. In fact, you don't have to use server controls for this.
    You can use a normal form and normal <input type="file"/>, <input
    type="submit"/> controls, and set the action of the form to the other page.
    Don't use a runat="server" form. A regular form will do. Then in the page
    you post to, just retrieve the form values.

    Best regards,
    Jeffrey Palermo

    "eswanson" <> wrote in message
    news:...
    > I have a web page I need to post a file plus some other fields to it. How
    > can I do this from a asp.net page. I know I can send individual fields to

    the
    > other page, but how do I send a file to the other page, or is there

    something
    > else like a stream which will be like a file. I am attempting to get a

    way
    > from writing out a file and then having to give the page that I am posting

    to
    > the file name. Instead I would like to just from asp.net post to the

    other
    > HTML page, the information, plus this file without writing a file out

    first.
     
    Jeffrey Palermo [MCP], Oct 30, 2004
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    Hi Jeff,

    Here is an example that does this in HTML, but I would like to do this in
    asp.net, but I do not want to create the file first, instead I would like to
    somehow stream the data to this post instead of writing out the file first
    and then having the user select the file and transfering it up to the host
    site. Is this possible?

    Here is the current html:

    <form method="post" enctype="multipart/form-data"
    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    <!--<form method="post" enctype="multipart/form-data"
    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    XML: <input type="file" name="xml" id="xml="><br>
    Batch ID: <input type="text" name="batchid" id="batchid="><br>
    Program Number: <input type="text" name="programnumber"
    id="programnumber="><br>
    <input type="submit">

    I am attempting to automated the input type="file", instead I would like to
    stream the file data from an asp.net page without first creating a file and
    then having the user select this file and transmitting it up to the other
    site. What other options do I have instead of creating the file first or is
    it possible to tell the input type='file' exactly what the file is and where
    it is?

    Thanks

    Eric

    "Jeffrey Palermo [MCP]" wrote:

    > You would do this exactly the same as you would do it in regular HTML
    > without ASP.NET. In fact, you don't have to use server controls for this.
    > You can use a normal form and normal <input type="file"/>, <input
    > type="submit"/> controls, and set the action of the form to the other page.
    > Don't use a runat="server" form. A regular form will do. Then in the page
    > you post to, just retrieve the form values.
    >
    > Best regards,
    > Jeffrey Palermo
    >
    > "eswanson" <> wrote in message
    > news:...
    > > I have a web page I need to post a file plus some other fields to it. How
    > > can I do this from a asp.net page. I know I can send individual fields to

    > the
    > > other page, but how do I send a file to the other page, or is there

    > something
    > > else like a stream which will be like a file. I am attempting to get a

    > way
    > > from writing out a file and then having to give the page that I am posting

    > to
    > > the file name. Instead I would like to just from asp.net post to the

    > other
    > > HTML page, the information, plus this file without writing a file out

    > first.
    >
    >
    >
     
    Guest, Oct 30, 2004
    #3
  4. Eric,
    I'm not sure I know exactly what you are trying to do, but if the file
    is coming from a user's machine, you can't automatically grab it. That
    would be a security issue. If the file is originating on the server, then
    there is no need for one page to grab it and post it to another page. The
    second page could just use the absolute path on the server or the network to
    open the file.

    Try reposting this question to the newsgroup, be more specific.

    Best regards,
    Jeffrey Palermo

    "eswanson" <> wrote in message
    news:...
    > Hi Jeff,
    >
    > Here is an example that does this in HTML, but I would like to do this in
    > asp.net, but I do not want to create the file first, instead I would like

    to
    > somehow stream the data to this post instead of writing out the file first
    > and then having the user select the file and transfering it up to the host
    > site. Is this possible?
    >
    > Here is the current html:
    >
    > <form method="post" enctype="multipart/form-data"
    > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > <!--<form method="post" enctype="multipart/form-data"
    > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > XML: <input type="file" name="xml" id="xml="><br>
    > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > Program Number: <input type="text" name="programnumber"
    > id="programnumber="><br>
    > <input type="submit">
    >
    > I am attempting to automated the input type="file", instead I would like

    to
    > stream the file data from an asp.net page without first creating a file

    and
    > then having the user select this file and transmitting it up to the other
    > site. What other options do I have instead of creating the file first or

    is
    > it possible to tell the input type='file' exactly what the file is and

    where
    > it is?
    >
    > Thanks
    >
    > Eric
    >
    > "Jeffrey Palermo [MCP]" wrote:
    >
    > > You would do this exactly the same as you would do it in regular HTML
    > > without ASP.NET. In fact, you don't have to use server controls for

    this.
    > > You can use a normal form and normal <input type="file"/>, <input
    > > type="submit"/> controls, and set the action of the form to the other

    page.
    > > Don't use a runat="server" form. A regular form will do. Then in the

    page
    > > you post to, just retrieve the form values.
    > >
    > > Best regards,
    > > Jeffrey Palermo
    > >
    > > "eswanson" <> wrote in message
    > > news:...
    > > > I have a web page I need to post a file plus some other fields to it.

    How
    > > > can I do this from a asp.net page. I know I can send individual fields

    to
    > > the
    > > > other page, but how do I send a file to the other page, or is there

    > > something
    > > > else like a stream which will be like a file. I am attempting to get

    a
    > > way
    > > > from writing out a file and then having to give the page that I am

    posting
    > > to
    > > > the file name. Instead I would like to just from asp.net post to the

    > > other
    > > > HTML page, the information, plus this file without writing a file out

    > > first.
    > >
    > >
    > >
     
    Jeffrey Palermo [MCP], Oct 31, 2004
    #4
  5. Guest

    Guest Guest

    Please read the entire reponse, hopefully this clears up your questions.

    The data used that needs to go into the batchupload page comes from a
    server. My problem is that currently I write a file to the server and then
    the user has to pick this file and send it up to the batchupload page. The
    batchupload page is not one of our page, instead it is another company's
    page. This is there interface to do batch processing. We have no control
    over it. We just call this page "batchupload" with a file and other
    parameters. I am attempting to call the page "batchupload" and send fill in
    the parameters with out first creating the file. Is this possible? Do you
    understand our problem.

    First batchupload is a page from another company. It is used for their
    batch processing. Request parameters include a file <html input type=file> -
    does this have to be a file or some other data stream stored on the page and
    then sent over to this page?

    The html page I sent you would be a page that was written for us to
    communicate with the batchupload page. I can hard code all of the other
    parameters except for the input type=file. Instead of writing out a file, I
    would like to buffer the file data into an asp.net page and then just send
    all of the information at once over to the "batchupload" page.

    I know that I can use
    httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumber='ABC'&xml=?????????)
    How do I specify the xml, since this variable is a file. What has to be in
    the data stream of xml, so that it appears to be a file, but is actually a
    character string?

    Hopefully this clears up the confusion.

    Thanks

    Eric

    "Jeffrey Palermo [MCP]" wrote:

    > Eric,
    > I'm not sure I know exactly what you are trying to do, but if the file
    > is coming from a user's machine, you can't automatically grab it. That
    > would be a security issue. If the file is originating on the server, then
    > there is no need for one page to grab it and post it to another page. The
    > second page could just use the absolute path on the server or the network to
    > open the file.
    >
    > Try reposting this question to the newsgroup, be more specific.
    >
    > Best regards,
    > Jeffrey Palermo
    >
    > "eswanson" <> wrote in message
    > news:...
    > > Hi Jeff,
    > >
    > > Here is an example that does this in HTML, but I would like to do this in
    > > asp.net, but I do not want to create the file first, instead I would like

    > to
    > > somehow stream the data to this post instead of writing out the file first
    > > and then having the user select the file and transfering it up to the host
    > > site. Is this possible?
    > >
    > > Here is the current html:
    > >
    > > <form method="post" enctype="multipart/form-data"
    > > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > <!--<form method="post" enctype="multipart/form-data"
    > > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > XML: <input type="file" name="xml" id="xml="><br>
    > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > Program Number: <input type="text" name="programnumber"
    > > id="programnumber="><br>
    > > <input type="submit">
    > >
    > > I am attempting to automated the input type="file", instead I would like

    > to
    > > stream the file data from an asp.net page without first creating a file

    > and
    > > then having the user select this file and transmitting it up to the other
    > > site. What other options do I have instead of creating the file first or

    > is
    > > it possible to tell the input type='file' exactly what the file is and

    > where
    > > it is?
    > >
    > > Thanks
    > >
    > > Eric
    > >
    > > "Jeffrey Palermo [MCP]" wrote:
    > >
    > > > You would do this exactly the same as you would do it in regular HTML
    > > > without ASP.NET. In fact, you don't have to use server controls for

    > this.
    > > > You can use a normal form and normal <input type="file"/>, <input
    > > > type="submit"/> controls, and set the action of the form to the other

    > page.
    > > > Don't use a runat="server" form. A regular form will do. Then in the

    > page
    > > > you post to, just retrieve the form values.
    > > >
    > > > Best regards,
    > > > Jeffrey Palermo
    > > >
    > > > "eswanson" <> wrote in message
    > > > news:...
    > > > > I have a web page I need to post a file plus some other fields to it.

    > How
    > > > > can I do this from a asp.net page. I know I can send individual fields

    > to
    > > > the
    > > > > other page, but how do I send a file to the other page, or is there
    > > > something
    > > > > else like a stream which will be like a file. I am attempting to get

    > a
    > > > way
    > > > > from writing out a file and then having to give the page that I am

    > posting
    > > > to
    > > > > the file name. Instead I would like to just from asp.net post to the
    > > > other
    > > > > HTML page, the information, plus this file without writing a file out
    > > > first.
    > > >
    > > >
    > > >

    >
    >
    >
     
    Guest, Nov 1, 2004
    #5
  6. Eric,
    I've done a bit of research on this, and you need to use the
    HttpWebRequest class in the System.Net namespace to create a custom web
    request that will post a file to an external website. I found a class that
    abstracts a lot of the code required:
    http://www.c-sharpcorner.com/Code/2003/May/DotNetBugs.asp
    Pull this class into your project, and then it will just take a few lines of
    code:
    MultipartForm mp = new MultipartForm(http://localhost/AcceptFile.aspx);
    mp.sendFile(@"c:\resetlog.txt");

    I was able to send my file to a web page that accepted it as a client
    upload. You can examine the code of MultipartForm for what code is actually
    run. It gets a little bit hairy.

    Best regards,

    Jeffrey Palermo

    "eswanson" <> wrote in message
    news:...
    > Please read the entire reponse, hopefully this clears up your questions.
    >
    > The data used that needs to go into the batchupload page comes from a
    > server. My problem is that currently I write a file to the server and

    then
    > the user has to pick this file and send it up to the batchupload page.

    The
    > batchupload page is not one of our page, instead it is another company's
    > page. This is there interface to do batch processing. We have no control
    > over it. We just call this page "batchupload" with a file and other
    > parameters. I am attempting to call the page "batchupload" and send fill

    in
    > the parameters with out first creating the file. Is this possible? Do

    you
    > understand our problem.
    >
    > First batchupload is a page from another company. It is used for their
    > batch processing. Request parameters include a file <html input

    type=file> -
    > does this have to be a file or some other data stream stored on the page

    and
    > then sent over to this page?
    >
    > The html page I sent you would be a page that was written for us to
    > communicate with the batchupload page. I can hard code all of the other
    > parameters except for the input type=file. Instead of writing out a file,

    I
    > would like to buffer the file data into an asp.net page and then just send
    > all of the information at once over to the "batchupload" page.
    >
    > I know that I can use
    >

    httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
    r='ABC'&xml=?????????)
    > How do I specify the xml, since this variable is a file. What has to be

    in
    > the data stream of xml, so that it appears to be a file, but is actually a
    > character string?
    >
    > Hopefully this clears up the confusion.
    >
    > Thanks
    >
    > Eric
    >
    > "Jeffrey Palermo [MCP]" wrote:
    >
    > > Eric,
    > > I'm not sure I know exactly what you are trying to do, but if the

    file
    > > is coming from a user's machine, you can't automatically grab it. That
    > > would be a security issue. If the file is originating on the server,

    then
    > > there is no need for one page to grab it and post it to another page.

    The
    > > second page could just use the absolute path on the server or the

    network to
    > > open the file.
    > >
    > > Try reposting this question to the newsgroup, be more specific.
    > >
    > > Best regards,
    > > Jeffrey Palermo
    > >
    > > "eswanson" <> wrote in message
    > > news:...
    > > > Hi Jeff,
    > > >
    > > > Here is an example that does this in HTML, but I would like to do this

    in
    > > > asp.net, but I do not want to create the file first, instead I would

    like
    > > to
    > > > somehow stream the data to this post instead of writing out the file

    first
    > > > and then having the user select the file and transfering it up to the

    host
    > > > site. Is this possible?
    > > >
    > > > Here is the current html:
    > > >
    > > > <form method="post" enctype="multipart/form-data"
    > > >

    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > > <!--<form method="post" enctype="multipart/form-data"
    > > >

    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > > XML: <input type="file" name="xml" id="xml="><br>
    > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > > Program Number: <input type="text" name="programnumber"
    > > > id="programnumber="><br>
    > > > <input type="submit">
    > > >
    > > > I am attempting to automated the input type="file", instead I would

    like
    > > to
    > > > stream the file data from an asp.net page without first creating a

    file
    > > and
    > > > then having the user select this file and transmitting it up to the

    other
    > > > site. What other options do I have instead of creating the file first

    or
    > > is
    > > > it possible to tell the input type='file' exactly what the file is and

    > > where
    > > > it is?
    > > >
    > > > Thanks
    > > >
    > > > Eric
    > > >
    > > > "Jeffrey Palermo [MCP]" wrote:
    > > >
    > > > > You would do this exactly the same as you would do it in regular

    HTML
    > > > > without ASP.NET. In fact, you don't have to use server controls for

    > > this.
    > > > > You can use a normal form and normal <input type="file"/>, <input
    > > > > type="submit"/> controls, and set the action of the form to the

    other
    > > page.
    > > > > Don't use a runat="server" form. A regular form will do. Then in

    the
    > > page
    > > > > you post to, just retrieve the form values.
    > > > >
    > > > > Best regards,
    > > > > Jeffrey Palermo
    > > > >
    > > > > "eswanson" <> wrote in message
    > > > > news:...
    > > > > > I have a web page I need to post a file plus some other fields to

    it.
    > > How
    > > > > > can I do this from a asp.net page. I know I can send individual

    fields
    > > to
    > > > > the
    > > > > > other page, but how do I send a file to the other page, or is

    there
    > > > > something
    > > > > > else like a stream which will be like a file. I am attempting to

    get
    > > a
    > > > > way
    > > > > > from writing out a file and then having to give the page that I am

    > > posting
    > > > > to
    > > > > > the file name. Instead I would like to just from asp.net post to

    the
    > > > > other
    > > > > > HTML page, the information, plus this file without writing a file

    out
    > > > > first.
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
    Jeffrey Palermo [MCP], Nov 6, 2004
    #6
  7. Eric,
    Another, easier but less flexible way to do it is to use the WebClient
    class:

    Console.Write("\nPlease enter the URI to post data to : ");

    String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";

    // Create a new WebClient instance.

    WebClient myWebClient = new WebClient();

    Console.WriteLine("\nPlease enter the fully qualified path of the file to be
    uploaded to the URI");

    string fileName = @"c:\upload.txt";

    Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);

    byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);


    // Decode and display the response.

    Console.WriteLine("\nResponse Received.The contents of the file uploaded
    are: \n{0}",Encoding.ASCII.GetString(responseArray));

    Console.ReadLine();



    Best regards,

    Jeffrey Palermo

    "eswanson" <> wrote in message
    news:...
    > Please read the entire reponse, hopefully this clears up your questions.
    >
    > The data used that needs to go into the batchupload page comes from a
    > server. My problem is that currently I write a file to the server and

    then
    > the user has to pick this file and send it up to the batchupload page.

    The
    > batchupload page is not one of our page, instead it is another company's
    > page. This is there interface to do batch processing. We have no control
    > over it. We just call this page "batchupload" with a file and other
    > parameters. I am attempting to call the page "batchupload" and send fill

    in
    > the parameters with out first creating the file. Is this possible? Do

    you
    > understand our problem.
    >
    > First batchupload is a page from another company. It is used for their
    > batch processing. Request parameters include a file <html input

    type=file> -
    > does this have to be a file or some other data stream stored on the page

    and
    > then sent over to this page?
    >
    > The html page I sent you would be a page that was written for us to
    > communicate with the batchupload page. I can hard code all of the other
    > parameters except for the input type=file. Instead of writing out a file,

    I
    > would like to buffer the file data into an asp.net page and then just send
    > all of the information at once over to the "batchupload" page.
    >
    > I know that I can use
    >

    httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
    r='ABC'&xml=?????????)
    > How do I specify the xml, since this variable is a file. What has to be

    in
    > the data stream of xml, so that it appears to be a file, but is actually a
    > character string?
    >
    > Hopefully this clears up the confusion.
    >
    > Thanks
    >
    > Eric
    >
    > "Jeffrey Palermo [MCP]" wrote:
    >
    > > Eric,
    > > I'm not sure I know exactly what you are trying to do, but if the

    file
    > > is coming from a user's machine, you can't automatically grab it. That
    > > would be a security issue. If the file is originating on the server,

    then
    > > there is no need for one page to grab it and post it to another page.

    The
    > > second page could just use the absolute path on the server or the

    network to
    > > open the file.
    > >
    > > Try reposting this question to the newsgroup, be more specific.
    > >
    > > Best regards,
    > > Jeffrey Palermo
    > >
    > > "eswanson" <> wrote in message
    > > news:...
    > > > Hi Jeff,
    > > >
    > > > Here is an example that does this in HTML, but I would like to do this

    in
    > > > asp.net, but I do not want to create the file first, instead I would

    like
    > > to
    > > > somehow stream the data to this post instead of writing out the file

    first
    > > > and then having the user select the file and transfering it up to the

    host
    > > > site. Is this possible?
    > > >
    > > > Here is the current html:
    > > >
    > > > <form method="post" enctype="multipart/form-data"
    > > >

    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > > <!--<form method="post" enctype="multipart/form-data"
    > > >

    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > > XML: <input type="file" name="xml" id="xml="><br>
    > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > > Program Number: <input type="text" name="programnumber"
    > > > id="programnumber="><br>
    > > > <input type="submit">
    > > >
    > > > I am attempting to automated the input type="file", instead I would

    like
    > > to
    > > > stream the file data from an asp.net page without first creating a

    file
    > > and
    > > > then having the user select this file and transmitting it up to the

    other
    > > > site. What other options do I have instead of creating the file first

    or
    > > is
    > > > it possible to tell the input type='file' exactly what the file is and

    > > where
    > > > it is?
    > > >
    > > > Thanks
    > > >
    > > > Eric
    > > >
    > > > "Jeffrey Palermo [MCP]" wrote:
    > > >
    > > > > You would do this exactly the same as you would do it in regular

    HTML
    > > > > without ASP.NET. In fact, you don't have to use server controls for

    > > this.
    > > > > You can use a normal form and normal <input type="file"/>, <input
    > > > > type="submit"/> controls, and set the action of the form to the

    other
    > > page.
    > > > > Don't use a runat="server" form. A regular form will do. Then in

    the
    > > page
    > > > > you post to, just retrieve the form values.
    > > > >
    > > > > Best regards,
    > > > > Jeffrey Palermo
    > > > >
    > > > > "eswanson" <> wrote in message
    > > > > news:...
    > > > > > I have a web page I need to post a file plus some other fields to

    it.
    > > How
    > > > > > can I do this from a asp.net page. I know I can send individual

    fields
    > > to
    > > > > the
    > > > > > other page, but how do I send a file to the other page, or is

    there
    > > > > something
    > > > > > else like a stream which will be like a file. I am attempting to

    get
    > > a
    > > > > way
    > > > > > from writing out a file and then having to give the page that I am

    > > posting
    > > > > to
    > > > > > the file name. Instead I would like to just from asp.net post to

    the
    > > > > other
    > > > > > HTML page, the information, plus this file without writing a file

    out
    > > > > first.
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
    Jeffrey Palermo [MCP], Nov 6, 2004
    #7
  8. Guest

    Guest Guest

    Jeff,

    Thanks for the suggestions, but I really do not want to prompt the user for
    a file and also, I really do not want to write a file out . Instead I would
    like to store the contents of the file on a aspx page and then press a button
    on that page and send this information to the page that wants a file and
    other inputs....

    I know that a 3rd party control wilsoncontrols will allow you to post data
    on this page to other pages. What I need assistance on is how what format
    does the paramater for the input=file needs to be? I do not want to write a
    file first, instead I want to store this information into a text box on the
    form.

    Hope this makes since.

    Thanks

    Eric

    "Jeffrey Palermo [MCP]" wrote:

    > Eric,
    > Another, easier but less flexible way to do it is to use the WebClient
    > class:
    >
    > Console.Write("\nPlease enter the URI to post data to : ");
    >
    > String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
    >
    > // Create a new WebClient instance.
    >
    > WebClient myWebClient = new WebClient();
    >
    > Console.WriteLine("\nPlease enter the fully qualified path of the file to be
    > uploaded to the URI");
    >
    > string fileName = @"c:\upload.txt";
    >
    > Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
    >
    > byte[] responseArray = myWebClient.UploadFile(uriString, "POST", fileName);
    >
    >
    > // Decode and display the response.
    >
    > Console.WriteLine("\nResponse Received.The contents of the file uploaded
    > are: \n{0}",Encoding.ASCII.GetString(responseArray));
    >
    > Console.ReadLine();
    >
    >
    >
    > Best regards,
    >
    > Jeffrey Palermo
    >
    > "eswanson" <> wrote in message
    > news:...
    > > Please read the entire reponse, hopefully this clears up your questions.
    > >
    > > The data used that needs to go into the batchupload page comes from a
    > > server. My problem is that currently I write a file to the server and

    > then
    > > the user has to pick this file and send it up to the batchupload page.

    > The
    > > batchupload page is not one of our page, instead it is another company's
    > > page. This is there interface to do batch processing. We have no control
    > > over it. We just call this page "batchupload" with a file and other
    > > parameters. I am attempting to call the page "batchupload" and send fill

    > in
    > > the parameters with out first creating the file. Is this possible? Do

    > you
    > > understand our problem.
    > >
    > > First batchupload is a page from another company. It is used for their
    > > batch processing. Request parameters include a file <html input

    > type=file> -
    > > does this have to be a file or some other data stream stored on the page

    > and
    > > then sent over to this page?
    > >
    > > The html page I sent you would be a page that was written for us to
    > > communicate with the batchupload page. I can hard code all of the other
    > > parameters except for the input type=file. Instead of writing out a file,

    > I
    > > would like to buffer the file data into an asp.net page and then just send
    > > all of the information at once over to the "batchupload" page.
    > >
    > > I know that I can use
    > >

    > httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
    > r='ABC'&xml=?????????)
    > > How do I specify the xml, since this variable is a file. What has to be

    > in
    > > the data stream of xml, so that it appears to be a file, but is actually a
    > > character string?
    > >
    > > Hopefully this clears up the confusion.
    > >
    > > Thanks
    > >
    > > Eric
    > >
    > > "Jeffrey Palermo [MCP]" wrote:
    > >
    > > > Eric,
    > > > I'm not sure I know exactly what you are trying to do, but if the

    > file
    > > > is coming from a user's machine, you can't automatically grab it. That
    > > > would be a security issue. If the file is originating on the server,

    > then
    > > > there is no need for one page to grab it and post it to another page.

    > The
    > > > second page could just use the absolute path on the server or the

    > network to
    > > > open the file.
    > > >
    > > > Try reposting this question to the newsgroup, be more specific.
    > > >
    > > > Best regards,
    > > > Jeffrey Palermo
    > > >
    > > > "eswanson" <> wrote in message
    > > > news:...
    > > > > Hi Jeff,
    > > > >
    > > > > Here is an example that does this in HTML, but I would like to do this

    > in
    > > > > asp.net, but I do not want to create the file first, instead I would

    > like
    > > > to
    > > > > somehow stream the data to this post instead of writing out the file

    > first
    > > > > and then having the user select the file and transfering it up to the

    > host
    > > > > site. Is this possible?
    > > > >
    > > > > Here is the current html:
    > > > >
    > > > > <form method="post" enctype="multipart/form-data"
    > > > >

    > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > > > <!--<form method="post" enctype="multipart/form-data"
    > > > >

    > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > > > XML: <input type="file" name="xml" id="xml="><br>
    > > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > > > Program Number: <input type="text" name="programnumber"
    > > > > id="programnumber="><br>
    > > > > <input type="submit">
    > > > >
    > > > > I am attempting to automated the input type="file", instead I would

    > like
    > > > to
    > > > > stream the file data from an asp.net page without first creating a

    > file
    > > > and
    > > > > then having the user select this file and transmitting it up to the

    > other
    > > > > site. What other options do I have instead of creating the file first

    > or
    > > > is
    > > > > it possible to tell the input type='file' exactly what the file is and
    > > > where
    > > > > it is?
    > > > >
    > > > > Thanks
    > > > >
    > > > > Eric
    > > > >
    > > > > "Jeffrey Palermo [MCP]" wrote:
    > > > >
    > > > > > You would do this exactly the same as you would do it in regular

    > HTML
    > > > > > without ASP.NET. In fact, you don't have to use server controls for
    > > > this.
    > > > > > You can use a normal form and normal <input type="file"/>, <input
    > > > > > type="submit"/> controls, and set the action of the form to the

    > other
    > > > page.
    > > > > > Don't use a runat="server" form. A regular form will do. Then in

    > the
    > > > page
    > > > > > you post to, just retrieve the form values.
    > > > > >
    > > > > > Best regards,
    > > > > > Jeffrey Palermo
    > > > > >
    > > > > > "eswanson" <> wrote in message
    > > > > > news:...
    > > > > > > I have a web page I need to post a file plus some other fields to

    > it.
    > > > How
    > > > > > > can I do this from a asp.net page. I know I can send individual

    > fields
    > > > to
    > > > > > the
    > > > > > > other page, but how do I send a file to the other page, or is

    > there
    > > > > > something
    > > > > > > else like a stream which will be like a file. I am attempting to

    > get
    > > > a
    > > > > > way
    > > > > > > from writing out a file and then having to give the page that I am
    > > > posting
    > > > > > to
    > > > > > > the file name. Instead I would like to just from asp.net post to

    > the
    > > > > > other
    > > > > > > HTML page, the information, plus this file without writing a file

    > out
    > > > > > first.
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
    Guest, Nov 8, 2004
    #8
  9. Good luck.


    "ejs" <> wrote in message
    news:...
    > Jeff,
    >
    > Thanks for the suggestions, but I really do not want to prompt the user

    for
    > a file and also, I really do not want to write a file out . Instead I

    would
    > like to store the contents of the file on a aspx page and then press a

    button
    > on that page and send this information to the page that wants a file and
    > other inputs....
    >
    > I know that a 3rd party control wilsoncontrols will allow you to post data
    > on this page to other pages. What I need assistance on is how what format
    > does the paramater for the input=file needs to be? I do not want to write

    a
    > file first, instead I want to store this information into a text box on

    the
    > form.
    >
    > Hope this makes since.
    >
    > Thanks
    >
    > Eric
    >
    > "Jeffrey Palermo [MCP]" wrote:
    >
    > > Eric,
    > > Another, easier but less flexible way to do it is to use the WebClient
    > > class:
    > >
    > > Console.Write("\nPlease enter the URI to post data to : ");
    > >
    > > String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
    > >
    > > // Create a new WebClient instance.
    > >
    > > WebClient myWebClient = new WebClient();
    > >
    > > Console.WriteLine("\nPlease enter the fully qualified path of the file

    to be
    > > uploaded to the URI");
    > >
    > > string fileName = @"c:\upload.txt";
    > >
    > > Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
    > >
    > > byte[] responseArray = myWebClient.UploadFile(uriString, "POST",

    fileName);
    > >
    > >
    > > // Decode and display the response.
    > >
    > > Console.WriteLine("\nResponse Received.The contents of the file uploaded
    > > are: \n{0}",Encoding.ASCII.GetString(responseArray));
    > >
    > > Console.ReadLine();
    > >
    > >
    > >
    > > Best regards,
    > >
    > > Jeffrey Palermo
    > >
    > > "eswanson" <> wrote in message
    > > news:...
    > > > Please read the entire reponse, hopefully this clears up your

    questions.
    > > >
    > > > The data used that needs to go into the batchupload page comes from a
    > > > server. My problem is that currently I write a file to the server and

    > > then
    > > > the user has to pick this file and send it up to the batchupload page.

    > > The
    > > > batchupload page is not one of our page, instead it is another

    company's
    > > > page. This is there interface to do batch processing. We have no

    control
    > > > over it. We just call this page "batchupload" with a file and other
    > > > parameters. I am attempting to call the page "batchupload" and send

    fill
    > > in
    > > > the parameters with out first creating the file. Is this possible?

    Do
    > > you
    > > > understand our problem.
    > > >
    > > > First batchupload is a page from another company. It is used for

    their
    > > > batch processing. Request parameters include a file <html input

    > > type=file> -
    > > > does this have to be a file or some other data stream stored on the

    page
    > > and
    > > > then sent over to this page?
    > > >
    > > > The html page I sent you would be a page that was written for us to
    > > > communicate with the batchupload page. I can hard code all of the

    other
    > > > parameters except for the input type=file. Instead of writing out a

    file,
    > > I
    > > > would like to buffer the file data into an asp.net page and then just

    send
    > > > all of the information at once over to the "batchupload" page.
    > > >
    > > > I know that I can use
    > > >

    > >

    httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
    > > r='ABC'&xml=?????????)
    > > > How do I specify the xml, since this variable is a file. What has to

    be
    > > in
    > > > the data stream of xml, so that it appears to be a file, but is

    actually a
    > > > character string?
    > > >
    > > > Hopefully this clears up the confusion.
    > > >
    > > > Thanks
    > > >
    > > > Eric
    > > >
    > > > "Jeffrey Palermo [MCP]" wrote:
    > > >
    > > > > Eric,
    > > > > I'm not sure I know exactly what you are trying to do, but if

    the
    > > file
    > > > > is coming from a user's machine, you can't automatically grab it.

    That
    > > > > would be a security issue. If the file is originating on the

    server,
    > > then
    > > > > there is no need for one page to grab it and post it to another

    page.
    > > The
    > > > > second page could just use the absolute path on the server or the

    > > network to
    > > > > open the file.
    > > > >
    > > > > Try reposting this question to the newsgroup, be more specific.
    > > > >
    > > > > Best regards,
    > > > > Jeffrey Palermo
    > > > >
    > > > > "eswanson" <> wrote in message
    > > > > news:...
    > > > > > Hi Jeff,
    > > > > >
    > > > > > Here is an example that does this in HTML, but I would like to do

    this
    > > in
    > > > > > asp.net, but I do not want to create the file first, instead I

    would
    > > like
    > > > > to
    > > > > > somehow stream the data to this post instead of writing out the

    file
    > > first
    > > > > > and then having the user select the file and transfering it up to

    the
    > > host
    > > > > > site. Is this possible?
    > > > > >
    > > > > > Here is the current html:
    > > > > >
    > > > > > <form method="post" enctype="multipart/form-data"
    > > > > >

    > > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > > > > <!--<form method="post" enctype="multipart/form-data"
    > > > > >

    > >

    action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > > > > XML: <input type="file" name="xml" id="xml="><br>
    > > > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > > > > Program Number: <input type="text" name="programnumber"
    > > > > > id="programnumber="><br>
    > > > > > <input type="submit">
    > > > > >
    > > > > > I am attempting to automated the input type="file", instead I

    would
    > > like
    > > > > to
    > > > > > stream the file data from an asp.net page without first creating a

    > > file
    > > > > and
    > > > > > then having the user select this file and transmitting it up to

    the
    > > other
    > > > > > site. What other options do I have instead of creating the file

    first
    > > or
    > > > > is
    > > > > > it possible to tell the input type='file' exactly what the file is

    and
    > > > > where
    > > > > > it is?
    > > > > >
    > > > > > Thanks
    > > > > >
    > > > > > Eric
    > > > > >
    > > > > > "Jeffrey Palermo [MCP]" wrote:
    > > > > >
    > > > > > > You would do this exactly the same as you would do it in regular

    > > HTML
    > > > > > > without ASP.NET. In fact, you don't have to use server controls

    for
    > > > > this.
    > > > > > > You can use a normal form and normal <input type="file"/>,

    <input
    > > > > > > type="submit"/> controls, and set the action of the form to the

    > > other
    > > > > page.
    > > > > > > Don't use a runat="server" form. A regular form will do. Then

    in
    > > the
    > > > > page
    > > > > > > you post to, just retrieve the form values.
    > > > > > >
    > > > > > > Best regards,
    > > > > > > Jeffrey Palermo
    > > > > > >
    > > > > > > "eswanson" <> wrote in message
    > > > > > > news:...
    > > > > > > > I have a web page I need to post a file plus some other fields

    to
    > > it.
    > > > > How
    > > > > > > > can I do this from a asp.net page. I know I can send

    individual
    > > fields
    > > > > to
    > > > > > > the
    > > > > > > > other page, but how do I send a file to the other page, or is

    > > there
    > > > > > > something
    > > > > > > > else like a stream which will be like a file. I am attempting

    to
    > > get
    > > > > a
    > > > > > > way
    > > > > > > > from writing out a file and then having to give the page that

    I am
    > > > > posting
    > > > > > > to
    > > > > > > > the file name. Instead I would like to just from asp.net post

    to
    > > the
    > > > > > > other
    > > > > > > > HTML page, the information, plus this file without writing a

    file
    > > out
    > > > > > > first.
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
    Jeffrey Palermo [MCP], Nov 9, 2004
    #9
  10. Guest

    Guest Guest

    Jeff,

    Is this possible to store the data in a text box and then somehow with the
    right format send it to a page that accepts a get? The question is what
    should the format of the text in the text box be?

    Thanks

    Eric

    "Jeffrey Palermo [MCP]" wrote:

    > Good luck.
    >
    >
    > "ejs" <> wrote in message
    > news:...
    > > Jeff,
    > >
    > > Thanks for the suggestions, but I really do not want to prompt the user

    > for
    > > a file and also, I really do not want to write a file out . Instead I

    > would
    > > like to store the contents of the file on a aspx page and then press a

    > button
    > > on that page and send this information to the page that wants a file and
    > > other inputs....
    > >
    > > I know that a 3rd party control wilsoncontrols will allow you to post data
    > > on this page to other pages. What I need assistance on is how what format
    > > does the paramater for the input=file needs to be? I do not want to write

    > a
    > > file first, instead I want to store this information into a text box on

    > the
    > > form.
    > >
    > > Hope this makes since.
    > >
    > > Thanks
    > >
    > > Eric
    > >
    > > "Jeffrey Palermo [MCP]" wrote:
    > >
    > > > Eric,
    > > > Another, easier but less flexible way to do it is to use the WebClient
    > > > class:
    > > >
    > > > Console.Write("\nPlease enter the URI to post data to : ");
    > > >
    > > > String uriString = "http://localhost/WebApplication1/AcceptFile.aspx";
    > > >
    > > > // Create a new WebClient instance.
    > > >
    > > > WebClient myWebClient = new WebClient();
    > > >
    > > > Console.WriteLine("\nPlease enter the fully qualified path of the file

    > to be
    > > > uploaded to the URI");
    > > >
    > > > string fileName = @"c:\upload.txt";
    > > >
    > > > Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
    > > >
    > > > byte[] responseArray = myWebClient.UploadFile(uriString, "POST",

    > fileName);
    > > >
    > > >
    > > > // Decode and display the response.
    > > >
    > > > Console.WriteLine("\nResponse Received.The contents of the file uploaded
    > > > are: \n{0}",Encoding.ASCII.GetString(responseArray));
    > > >
    > > > Console.ReadLine();
    > > >
    > > >
    > > >
    > > > Best regards,
    > > >
    > > > Jeffrey Palermo
    > > >
    > > > "eswanson" <> wrote in message
    > > > news:...
    > > > > Please read the entire reponse, hopefully this clears up your

    > questions.
    > > > >
    > > > > The data used that needs to go into the batchupload page comes from a
    > > > > server. My problem is that currently I write a file to the server and
    > > > then
    > > > > the user has to pick this file and send it up to the batchupload page.
    > > > The
    > > > > batchupload page is not one of our page, instead it is another

    > company's
    > > > > page. This is there interface to do batch processing. We have no

    > control
    > > > > over it. We just call this page "batchupload" with a file and other
    > > > > parameters. I am attempting to call the page "batchupload" and send

    > fill
    > > > in
    > > > > the parameters with out first creating the file. Is this possible?

    > Do
    > > > you
    > > > > understand our problem.
    > > > >
    > > > > First batchupload is a page from another company. It is used for

    > their
    > > > > batch processing. Request parameters include a file <html input
    > > > type=file> -
    > > > > does this have to be a file or some other data stream stored on the

    > page
    > > > and
    > > > > then sent over to this page?
    > > > >
    > > > > The html page I sent you would be a page that was written for us to
    > > > > communicate with the batchupload page. I can hard code all of the

    > other
    > > > > parameters except for the input type=file. Instead of writing out a

    > file,
    > > > I
    > > > > would like to buffer the file data into an asp.net page and then just

    > send
    > > > > all of the information at once over to the "batchupload" page.
    > > > >
    > > > > I know that I can use
    > > > >
    > > >

    > httpppost(http://www.othercompany.com/batchupload?batchid='123'&programnumbe
    > > > r='ABC'&xml=?????????)
    > > > > How do I specify the xml, since this variable is a file. What has to

    > be
    > > > in
    > > > > the data stream of xml, so that it appears to be a file, but is

    > actually a
    > > > > character string?
    > > > >
    > > > > Hopefully this clears up the confusion.
    > > > >
    > > > > Thanks
    > > > >
    > > > > Eric
    > > > >
    > > > > "Jeffrey Palermo [MCP]" wrote:
    > > > >
    > > > > > Eric,
    > > > > > I'm not sure I know exactly what you are trying to do, but if

    > the
    > > > file
    > > > > > is coming from a user's machine, you can't automatically grab it.

    > That
    > > > > > would be a security issue. If the file is originating on the

    > server,
    > > > then
    > > > > > there is no need for one page to grab it and post it to another

    > page.
    > > > The
    > > > > > second page could just use the absolute path on the server or the
    > > > network to
    > > > > > open the file.
    > > > > >
    > > > > > Try reposting this question to the newsgroup, be more specific.
    > > > > >
    > > > > > Best regards,
    > > > > > Jeffrey Palermo
    > > > > >
    > > > > > "eswanson" <> wrote in message
    > > > > > news:...
    > > > > > > Hi Jeff,
    > > > > > >
    > > > > > > Here is an example that does this in HTML, but I would like to do

    > this
    > > > in
    > > > > > > asp.net, but I do not want to create the file first, instead I

    > would
    > > > like
    > > > > > to
    > > > > > > somehow stream the data to this post instead of writing out the

    > file
    > > > first
    > > > > > > and then having the user select the file and transfering it up to

    > the
    > > > host
    > > > > > > site. Is this possible?
    > > > > > >
    > > > > > > Here is the current html:
    > > > > > >
    > > > > > > <form method="post" enctype="multipart/form-data"
    > > > > > >
    > > > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload"/>
    > > > > > > <!--<form method="post" enctype="multipart/form-data"
    > > > > > >
    > > >

    > action="https://egov.immigration.gov/sbtsevisbatch/action/batchUpload">-->
    > > > > > > XML: <input type="file" name="xml" id="xml="><br>
    > > > > > > Batch ID: <input type="text" name="batchid" id="batchid="><br>
    > > > > > > Program Number: <input type="text" name="programnumber"
    > > > > > > id="programnumber="><br>
    > > > > > > <input type="submit">
    > > > > > >
    > > > > > > I am attempting to automated the input type="file", instead I

    > would
    > > > like
    > > > > > to
    > > > > > > stream the file data from an asp.net page without first creating a
    > > > file
    > > > > > and
    > > > > > > then having the user select this file and transmitting it up to

    > the
    > > > other
    > > > > > > site. What other options do I have instead of creating the file

    > first
    > > > or
    > > > > > is
    > > > > > > it possible to tell the input type='file' exactly what the file is

    > and
    > > > > > where
    > > > > > > it is?
    > > > > > >
    > > > > > > Thanks
    > > > > > >
    > > > > > > Eric
    > > > > > >
    > > > > > > "Jeffrey Palermo [MCP]" wrote:
    > > > > > >
    > > > > > > > You would do this exactly the same as you would do it in regular
    > > > HTML
    > > > > > > > without ASP.NET. In fact, you don't have to use server controls

    > for
    > > > > > this.
    > > > > > > > You can use a normal form and normal <input type="file"/>,

    > <input
    > > > > > > > type="submit"/> controls, and set the action of the form to the
    > > > other
    > > > > > page.
    > > > > > > > Don't use a runat="server" form. A regular form will do. Then

    > in
    > > > the
    > > > > > page
    > > > > > > > you post to, just retrieve the form values.
    > > > > > > >
    > > > > > > > Best regards,
    > > > > > > > Jeffrey Palermo
    > > > > > > >
    > > > > > > > "eswanson" <> wrote in message
    > > > > > > > news:...
    > > > > > > > > I have a web page I need to post a file plus some other fields

    > to
    > > > it.
    > > > > > How
    > > > > > > > > can I do this from a asp.net page. I know I can send

    > individual
    > > > fields
    > > > > > to
    > > > > > > > the
    > > > > > > > > other page, but how do I send a file to the other page, or is
    > > > there
    > > > > > > > something
    > > > > > > > > else like a stream which will be like a file. I am attempting

    > to
    > > > get
    > > > > > a
    > > > > > > > way
    > > > > > > > > from writing out a file and then having to give the page that

    > I am
    > > > > > posting
    > > > > > > > to
    > > > > > > > > the file name. Instead I would like to just from asp.net post

    > to
    > > > the
    > > > > > > > other
    > > > > > > > > HTML page, the information, plus this file without writing a

    > file
    > > > out
    > > > > > > > first.
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
    Guest, Nov 9, 2004
    #10
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Jackson

    Re: .net Post to remote page OR send data asp.net to asp

    Chris Jackson, Aug 18, 2003, in forum: Microsoft ASP .NET
    Replies:
    0
    Views:
    265
    Chris Jackson
    Aug 18, 2003
  2. MS News \(MS ILM\)

    Re: Mixing ASP and ASP.Net - "SET" not accepted by ASP.Net

    MS News \(MS ILM\), Aug 20, 2003, in forum: Microsoft ASP .NET
    Replies:
    0
    Views:
    217
    MS News \(MS ILM\)
    Aug 20, 2003
  3. Ben

    ASP.Net cookie -> ASP -> ASP.Net

    Ben, May 27, 2004, in forum: Microsoft ASP .NET
    Replies:
    3
    Views:
    751
  4. Guest
    Replies:
    0
    Views:
    368
    Guest
    Dec 31, 2004
  5. Andrea Raimondi
    Replies:
    1
    Views:
    254
Loading...

Share This Page