Post using Response.Write

J

Jer425

Hello all,

I'm trying to post to another page from asp.net and direct the user
there. I've looked through the group and found a lot of information.
The following code may work well for what I'm doing.

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

** Response.Write("<!-- Include File='Example.aspx' -->")
Response.Write("<form name='Form2' action='UrlHere' method='POST' >")
** Response.Write("<% Example() %>")
Response.Write("<INPUT type='hidden' name='none' value='none'>")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.Form2.Submit();")
Response.Write("</script>")

End Sub

The problem I'm having is trying to implement the include file and run
functions from it. If I remove the code for the function and the
include file (labeled with **) the post will work, but without them it
isn't working the way I need it to.

Does anyone know of a way that I can implement this include file into
the following code and run fuctions from it?

Thanks
 
J

Jer425

Thank you for the response.

When I use the code below in html, I'm able to run the function from
the Example.aspx include file. Only when moving it to the code behind
with response.write is when I get a problem as I mentioned above.

<FORM id="Form2" action="UrlHere" method="post">

<!-- #Include File="Example.aspx" -->
<% Example() %>
<INPUT type='hidden' name='none' value='none'>
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">

</FORM>
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

That is because you are trying to use Response.Write as a time machine. ;)

The SSI (server side include) is performed before the ASP.NET code is
compiled. That means that once the code is running, it's too late to
make an include.

Also, you are trying to write ASP.NET code to the page to have it
executed. As the code of the page has already been compiled, it's too
late to add more code.

Whatever you write to the page using Response.Write will just end up in
the html code of the page.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top