473,769 Members | 5,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Post using Response.Write

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.EventArg s) Handles btnSubmit.Click

** Response.Write( "<!-- Include File='Example.a spx' -->")
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

Jul 10 '06 #1
3 8846
You can not use include files that are aspx pages in ASP.Net. The reason is
that the pages are compiled and run before being sent to the client.

Read this article, it will tell you how to accomplish what you are asking.

http://support.microsoft.com/default...b;en-us;306575

--
-Demetri
"Jer425" wrote:
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.EventArg s) Handles btnSubmit.Click

** Response.Write( "<!-- Include File='Example.a spx' -->")
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

Jul 10 '06 #2
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.a spx" -->
<% Example() %>
<INPUT type='hidden' name='none' value='none'>
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">

</FORM>

Jul 10 '06 #3
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.
Jer425 wrote:
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.a spx" -->
<% Example() %>
<INPUT type='hidden' name='none' value='none'>
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">

</FORM>
Jul 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6344
by: eddie wang | last post by:
How to convert the following html to asp page using response.write? Thanks. <td align="right"><Font class=content4><%=ars.Fields("REVENUE")%></td> *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
4
4213
by: Nevyn Twyll | last post by:
Is there any way I can use a code-behind event (like a btn_Click event) to write some javascript into the Response? I was thinking of using Response.Write() to write the following code into the response: window.open("mynextpage.aspx","_blank", "height=300, width=450, left=100, top=100, " + "location=no, menubar=no, resizable=no, " + "scrollbars=no, titlebar=no, toolbar=no", true);
3
6638
by: PK9 | last post by:
I'm having some issues with using a Response.Write or the shortcut ( <%= ...) from within a label control. I cannot do this in the code behind, I need to do it here at runtime. I have a public function (GetMsgs) in my code behind page that returns a string back to the caller. I want to call this function from the ASPX page and return the value to a Label control. I have tried the following options but cannot get it to work: 1)...
3
5586
by: Coby Herd | last post by:
I cannot find any information on how to insert an image into a block of text and have the text wrap around the image. All if the text and graphics in the client's site are being pulled from the database using response.write. When I write straight HTML, it is easy to place an image into a block of text and align the image right or left, having the text wrap around the image. Can anybody offer any suggestions? Thanx
14
2708
by: Piotrek | last post by:
Hi all. I have a web app, in which I use frames. My main frameset consists of three inner frames. When some button is pressed in frame A, then content of frame B is reloaded. I am using such code to achieve this: string strRedirect; strRedirect = "<script language='Javascript'>"; strRedirect += "parent.body.location.href='WFSearchResult.aspx';";
1
9358
by: ChristopherABurns | last post by:
I have a very simple code snippet here: private void Page_Load(object sender, System.EventArgs e) { string filePath = Server.MapPath("\\Transcriber\\TranscriberTest\\"); string fileName = "Test.Zip"; //FileInfo fi = new FileInfo(filePath + fileName); FileStream fs = File.Open(filePath + fileName,FileMode.Open);
3
6442
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating imagebuttons which point to a dummy page that takes the image and displays it via response. All works fine if I use explicit paths to a file (response.writefile(<filename>) or directly pass through the database image...
7
3310
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server...
5
6704
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con = ConfigurationManager.ConnectionStrings.ConnectionString; protected void Page_Load(object sender, EventArgs e) { try
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.