Thanks for your followup Jeeran,
Walter has been absent due to some urgent issue and I'll help him work on
this issue.
From your last reply, my understanding on this issue is that you have the
following two concerns correctly:
1. The data you collected will be posted to a remote site and you do not
want the data to be exposed in url querystring or any client-side script
(AJAX)
2. You will need to perform some server-side processing before submit the
data to the remote site.
Regarding on this , I'm wondering the following points:
1) Is the server-side processing (in code-behind) related to the data you
submit to the remote site or will the processing result affect the
submiting?
2) Do you think it convenient or doable if we first submit to the same
form(main form) and then register some client-side script to resubmit the
page to remote site after postback?
so far, based on my research, there are two potential solutions:
1. In ASP.NET 2.0, the webform support cross-page postback, thus, we can
add a button on the web form and set its "PostBackUrl" to the remote
site(and use css style to hide it). Then, in a normal submit's postback
event, we do those necessary server-side processing in code behind and
programmtically register some scripts to invoke that Button(whose
"PostBackUrl" is pointing to the remote site) 's "click" method
#Cross-Page Posting in ASP.NET Web Pages
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
2. Still use an additional form to post to remote site. We can make it
invisible through css style. And in our main form, we add a submit button
which will postback to do those necessary server-side tasks and then
programmtically register client-side script to submit that additinal hidden
form. Also, in thise case, we need to programmtically copy the data from
the textboxes in main form into the textbox(<input type="text" ..../>) in
the additional form.
Here is a test page which demonstrate both of the above two approahes(I've
also attached the complete test page, aspx and codebehind cs file in this
message, you can get it if you are using Outlook express to visit the
newsgroup):
===========aspx ===============
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" >
function submit_remoteform()
{
document.forms["remoteform"].submit();
}
</script>
</head>
<body>
<form id="remoteform" action="targetpage.aspx" method="post"
style="display:none">
Remote Form<br /><hr />
<br />
<input id="txt1" name="txt1" type="text" value='<%= txt1.Text %>' />
<input id="txt2" name="txt2" type="text" value='<%= txt2.Text %>'/>
</form>
<form id="form1" runat="server">
<div>
Main form<br /><hr />
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<asp:TextBox ID="txt2" runat="server"></asp:TextBox>
<asp:Button ID="btnSubmit" runat="server" Text="Submit Through Main
Form" OnClick="btnSubmit_Click" />
<asp:Button ID="Button2" runat="server"
PostBackUrl="TargetPage.aspx" Text="Button" style="display:none" /><br />
<asp:Button ID="Button1" runat="server" Text="Submit Through
Additional Form" OnClick="Button1_Click" />
<br />
<br />
<br />
</div>
</form>
</body>
</html>
==================================
========code behind======================
public partial class ClientSide_SourcePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Response.Write("<br/>btnSubmit_Click....." +
DateTime.Now.ToLongTimeString());
Page.ClientScript.RegisterStartupScript(this.GetType(),
"post_main_form",
"document.getElementById('Button2').click();", true);
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<br/>Button1_Click....." +
DateTime.Now.ToLongTimeString());
Page.ClientScript.RegisterStartupScript(this.GetType(),
"post_main_form",
"submit_remoteform();", true);
}
}
===========================================
Please feel free to let me know if there is anything unclear or any other
information you wonder.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.