Multiple <Forms in 1.1

Discussion in 'ASP .Net' started by Jordan, Sep 5, 2005.

  1. Jordan

    Jordan Guest

    I have a situation in which I need to:
    1. Programmatically construct an html <form... method=POST> (NO
    runat=server)
    2. My user clicks to POST that form to a separate Web site.
    3. When the <form gets posted to the other Web site, the other Web site
    responds by showing a new page to my user - the new page is from the other
    Web site. Essentially my user gets transferred to the other Web site at the
    time the form gets posted.

    I'd like to just construct the HTML for the <form> (to be POSTed to the
    other site) as a string that gets injected into the aspx page on my site via
    a Literal control. But the problem is that this would create a situation
    where I have nested <forms (one is mine with runat=server, and the other is
    the one I construct in code-behind and inject into the Literal). AFAIK,
    nested forms is disallowed by the HTML specification.

    So, how can I accomplish this objective? (I have to make this fly with 1.1).
    I thought one workaround would be to just use the WebClient to POST the
    <form to the other Web site, but I don't think that would allow the other
    site to show my user the new page (from the other web site).

    Any ideas?

    Thanks!
    Jordan, Sep 5, 2005
    #1
    1. Advertising

  2. Jordan

    Jordan Guest

    Clarification:
    While my OP described the objective clearly, it could be even more clear : )
    Steps 1 and 2 from the OP don't really need to happen (although they are one
    way to satisfy the requirements).

    Specifically, I don't need for the 2nd form to actually appear on my aspx
    page and for the user to click to POST... if I can construct the <form> to
    be POSTed to the other site in my code-behind (as a string), POST it to the
    other site, AND have the user see the resulting page from the other site.
    This would be ideal.

    The part I don't understand is how to let the user see the page that the
    other site sends in response to the POST sent via the WebClient in my
    code-behind. If I can learn how to do this, then I'm good to go.

    Sorry if this clarification of the problem causes any confusion...
    Jordan, Sep 5, 2005
    #2
    1. Advertising

  3. Jordan,

    One easy way would be to place the received stream into a literal control
    like this:

    '---Create the request

    Dim WebRequest As System.Net.WebRequest = System.Net.WebRequest.Create(New
    Uri(CurrentLink))

    WebRequest.Timeout = 2000

    '---Get the response produced by the request

    Dim Response As System.Net.WebResponse = WebRequest.GetResponse

    '---Download the page content into a stream

    Dim Stream As System.IO.Stream = Response.GetResponseStream

    '---Place the stream into a stream reader

    Dim StreamReader As New System.IO.StreamReader(Stream)

    '---Read the stream into a string object

    Dim HtmlReceived As String = StreamReader.ReadToEnd

    '---Place the string into a literal control

    Literal1.Text = HtmlReceived

    '---Cleanup

    Stream.Close()

    StreamReader.Close()


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Jordan" <> wrote in message
    news:...
    > Clarification:
    > While my OP described the objective clearly, it could be even more clear
    > : )
    > Steps 1 and 2 from the OP don't really need to happen (although they are
    > one way to satisfy the requirements).
    >
    > Specifically, I don't need for the 2nd form to actually appear on my aspx
    > page and for the user to click to POST... if I can construct the <form> to
    > be POSTed to the other site in my code-behind (as a string), POST it to
    > the other site, AND have the user see the resulting page from the other
    > site. This would be ideal.
    >
    > The part I don't understand is how to let the user see the page that the
    > other site sends in response to the POST sent via the WebClient in my
    > code-behind. If I can learn how to do this, then I'm good to go.
    >
    > Sorry if this clarification of the problem causes any confusion...
    >
    >
    >
    S. Justin Gengo, Sep 5, 2005
    #3
  4. Jordan

    Jordan Guest

    Sounds good... one twist is that the other page is sending the user a
    secured page (https) while mine is not secured (http).

    Any other ideas?


    "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > Jordan,
    >
    > One easy way would be to place the received stream into a literal control
    > like this:
    >
    > '---Create the request
    >
    > Dim WebRequest As System.Net.WebRequest = System.Net.WebRequest.Create(New
    > Uri(CurrentLink))
    >
    > WebRequest.Timeout = 2000
    >
    > '---Get the response produced by the request
    >
    > Dim Response As System.Net.WebResponse = WebRequest.GetResponse
    >
    > '---Download the page content into a stream
    >
    > Dim Stream As System.IO.Stream = Response.GetResponseStream
    >
    > '---Place the stream into a stream reader
    >
    > Dim StreamReader As New System.IO.StreamReader(Stream)
    >
    > '---Read the stream into a string object
    >
    > Dim HtmlReceived As String = StreamReader.ReadToEnd
    >
    > '---Place the string into a literal control
    >
    > Literal1.Text = HtmlReceived
    >
    > '---Cleanup
    >
    > Stream.Close()
    >
    > StreamReader.Close()
    >
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "Jordan" <> wrote in message
    > news:...
    >> Clarification:
    >> While my OP described the objective clearly, it could be even more clear
    >> : )
    >> Steps 1 and 2 from the OP don't really need to happen (although they are
    >> one way to satisfy the requirements).
    >>
    >> Specifically, I don't need for the 2nd form to actually appear on my aspx
    >> page and for the user to click to POST... if I can construct the <form>
    >> to be POSTed to the other site in my code-behind (as a string), POST it
    >> to the other site, AND have the user see the resulting page from the
    >> other site. This would be ideal.
    >>
    >> The part I don't understand is how to let the user see the page that the
    >> other site sends in response to the POST sent via the WebClient in my
    >> code-behind. If I can learn how to do this, then I'm good to go.
    >>
    >> Sorry if this clarification of the problem causes any confusion...
    >>
    >>
    >>

    >
    >
    Jordan, Sep 5, 2005
    #4
  5. Jordan,

    In that case an iFrame is about your only choice...

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Jordan" <> wrote in message
    news:%...
    > Sounds good... one twist is that the other page is sending the user a
    > secured page (https) while mine is not secured (http).
    >
    > Any other ideas?
    >
    >
    > "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    > message news:...
    >> Jordan,
    >>
    >> One easy way would be to place the received stream into a literal control
    >> like this:
    >>
    >> '---Create the request
    >>
    >> Dim WebRequest As System.Net.WebRequest =
    >> System.Net.WebRequest.Create(New Uri(CurrentLink))
    >>
    >> WebRequest.Timeout = 2000
    >>
    >> '---Get the response produced by the request
    >>
    >> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
    >>
    >> '---Download the page content into a stream
    >>
    >> Dim Stream As System.IO.Stream = Response.GetResponseStream
    >>
    >> '---Place the stream into a stream reader
    >>
    >> Dim StreamReader As New System.IO.StreamReader(Stream)
    >>
    >> '---Read the stream into a string object
    >>
    >> Dim HtmlReceived As String = StreamReader.ReadToEnd
    >>
    >> '---Place the string into a literal control
    >>
    >> Literal1.Text = HtmlReceived
    >>
    >> '---Cleanup
    >>
    >> Stream.Close()
    >>
    >> StreamReader.Close()
    >>
    >>
    >> --
    >> Sincerely,
    >>
    >> S. Justin Gengo, MCP
    >> Web Developer / Programmer
    >>
    >> www.aboutfortunate.com
    >>
    >> "Out of chaos comes order."
    >> Nietzsche
    >> "Jordan" <> wrote in message
    >> news:...
    >>> Clarification:
    >>> While my OP described the objective clearly, it could be even more clear
    >>> : )
    >>> Steps 1 and 2 from the OP don't really need to happen (although they are
    >>> one way to satisfy the requirements).
    >>>
    >>> Specifically, I don't need for the 2nd form to actually appear on my
    >>> aspx page and for the user to click to POST... if I can construct the
    >>> <form> to be POSTed to the other site in my code-behind (as a string),
    >>> POST it to the other site, AND have the user see the resulting page from
    >>> the other site. This would be ideal.
    >>>
    >>> The part I don't understand is how to let the user see the page that the
    >>> other site sends in response to the POST sent via the WebClient in my
    >>> code-behind. If I can learn how to do this, then I'm good to go.
    >>>
    >>> Sorry if this clarification of the problem causes any confusion...
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
    S. Justin Gengo, Sep 6, 2005
    #5
  6. Jordan

    Jordan Guest

    Thanks for your info.




    "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    message news:...
    > Jordan,
    >
    > In that case an iFrame is about your only choice...
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "Jordan" <> wrote in message
    > news:%...
    >> Sounds good... one twist is that the other page is sending the user a
    >> secured page (https) while mine is not secured (http).
    >>
    >> Any other ideas?
    >>
    >>
    >> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
    >> message news:...
    >>> Jordan,
    >>>
    >>> One easy way would be to place the received stream into a literal
    >>> control like this:
    >>>
    >>> '---Create the request
    >>>
    >>> Dim WebRequest As System.Net.WebRequest =
    >>> System.Net.WebRequest.Create(New Uri(CurrentLink))
    >>>
    >>> WebRequest.Timeout = 2000
    >>>
    >>> '---Get the response produced by the request
    >>>
    >>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
    >>>
    >>> '---Download the page content into a stream
    >>>
    >>> Dim Stream As System.IO.Stream = Response.GetResponseStream
    >>>
    >>> '---Place the stream into a stream reader
    >>>
    >>> Dim StreamReader As New System.IO.StreamReader(Stream)
    >>>
    >>> '---Read the stream into a string object
    >>>
    >>> Dim HtmlReceived As String = StreamReader.ReadToEnd
    >>>
    >>> '---Place the string into a literal control
    >>>
    >>> Literal1.Text = HtmlReceived
    >>>
    >>> '---Cleanup
    >>>
    >>> Stream.Close()
    >>>
    >>> StreamReader.Close()
    >>>
    >>>
    >>> --
    >>> Sincerely,
    >>>
    >>> S. Justin Gengo, MCP
    >>> Web Developer / Programmer
    >>>
    >>> www.aboutfortunate.com
    >>>
    >>> "Out of chaos comes order."
    >>> Nietzsche
    >>> "Jordan" <> wrote in message
    >>> news:...
    >>>> Clarification:
    >>>> While my OP described the objective clearly, it could be even more
    >>>> clear : )
    >>>> Steps 1 and 2 from the OP don't really need to happen (although they
    >>>> are one way to satisfy the requirements).
    >>>>
    >>>> Specifically, I don't need for the 2nd form to actually appear on my
    >>>> aspx page and for the user to click to POST... if I can construct the
    >>>> <form> to be POSTed to the other site in my code-behind (as a string),
    >>>> POST it to the other site, AND have the user see the resulting page
    >>>> from the other site. This would be ideal.
    >>>>
    >>>> The part I don't understand is how to let the user see the page that
    >>>> the other site sends in response to the POST sent via the WebClient in
    >>>> my code-behind. If I can learn how to do this, then I'm good to go.
    >>>>
    >>>> Sorry if this clarification of the problem causes any confusion...
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Jordan, Sep 6, 2005
    #6
    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.
Similar Threads
  1. Brendan Miller

    Web Forms VS Windows Forms

    Brendan Miller, Aug 11, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    5,055
    Kevin Spencer
    Aug 11, 2003
  2. doug
    Replies:
    6
    Views:
    4,613
    Andrew Thompson
    Jan 27, 2004
  3. Keltex
    Replies:
    1
    Views:
    385
    Dominick Baier [DevelopMentor]
    Jan 24, 2006
  4. Eric
    Replies:
    2
    Views:
    459
  5. sandyde2
    Replies:
    2
    Views:
    173
    sandyde2
    Oct 2, 2003
Loading...

Share This Page