Submit a form from code

Discussion in 'ASP .Net' started by Shawn, Jul 4, 2005.

  1. Shawn

    Shawn Guest

    Hi.
    I'm given a URL that takes me to a page that looks someting like this:

    <html xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-16">
    <link href="css/default.css" REL="stylesheet">
    <body onLoad="document.forms[0].submit()">

    <form
    action="http://internal-server//login.asp?fds=File&doc=102&current=1&seq=1"
    method="post" name="form1">
    <input type="hidden" name="username" style="width: 150px" value="test_user">
    <input type="hidden" name="password" style="width: 150px" VALUE="test_pass">

    <input type="submit" value="Login" style="width: 80px">

    </form>
    </body>
    </html>

    When the page loads it automatically logges me onto the system and then
    redirects me to a file (pdf, xsl, doc etc). My problem is that I have to
    download this file through my code and store it on the web server without a
    user interface. Is there someone who can tell me how I can accomplish this?

    Thanks,
    Shawn
     
    Shawn, Jul 4, 2005
    #1
    1. Advertising

  2. Shawn

    Guest

    Hello Shawn,
    You want to do operation idealy performed by your browser. Am I right?
    Find class that that allow you to send request and able to grab the
    response.
    That response will be saved in variable then store it where you want.
    I dont know excatly but i think you will get such class in system.net.
    happy coading
    bhawin13
     
    , Jul 4, 2005
    #2
    1. Advertising

  3. Shawn

    Guest

    Hello Shawn,
    You want to do operation idealy performed by your browser. Am I right?
    Find class that that allow you to send request and able to grab the
    response.
    That response will be saved in variable then store it where you want.
    I dont know excatly but i think you will get such class in system.net.
    happy coading
    bhawin13
     
    , Jul 4, 2005
    #3
  4. Hi Shawn, as bhawin13 suggested the class you are looking for is
    System.Net.HttpWebRequest

    jd

    "Shawn" wrote:

    > Hi.
    > I'm given a URL that takes me to a page that looks someting like this:
    >
    > <html xmlns:fo="http://www.w3.org/1999/XSL/Format">
    > <head>
    > <META http-equiv="Content-Type" content="text/html; charset=UTF-16">
    > <link href="css/default.css" REL="stylesheet">
    > <body onLoad="document.forms[0].submit()">
    >
    > <form
    > action="http://internal-server//login.asp?fds=File&doc=102¤t=1&seq=1"
    > method="post" name="form1">
    > <input type="hidden" name="username" style="width: 150px" value="test_user">
    > <input type="hidden" name="password" style="width: 150px" VALUE="test_pass">
    >
    > <input type="submit" value="Login" style="width: 80px">
    >
    > </form>
    > </body>
    > </html>
    >
    > When the page loads it automatically logges me onto the system and then
    > redirects me to a file (pdf, xsl, doc etc). My problem is that I have to
    > download this file through my code and store it on the web server without a
    > user interface. Is there someone who can tell me how I can accomplish this?
    >
    > Thanks,
    > Shawn
    >
    >
    >
     
    =?Utf-8?B?bG9uZG9uIGNhbGxpbmc=?=, Jul 4, 2005
    #4
    1. Advertising

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.

Share This Page