473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Submitting Data to Another Page Using ASP.NET

I need to post an ASP.NET form between sites for report processing.
Site A contains the asp.net forms and site B contains Java Servlets for
report processing.

All form fields values must be passed to the reporting servlet via http
post method. No parameters can be transmitted by URL. The report must
display in a NEW browser window. Does anyone know how to set a target
using httpwebrequest or is there another alternative?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
4 2934
Hi Dennis,

I've had success doing that using the Webclient class. You need to know
exactly what form field names the target expects.

Not sure about setting it to open in a new page.

Anyway, here's some code to give you an idea:

Sub DoPost()
Dim uriString As String = _
"http://localhost/p4320work/mySpecialPage.aspx"
Dim strGoName As String
strGoName = TextBox1.Text
' Create a new WebClient instance.
Dim myWebClient As New System.Net.WebClient
Dim myNameValueCollection As New _
System.Collections.Specialized.NameValueCollection
myNameValueCollection.Add("go1", strGoName)
myNameValueCollection.Add("Button1", "")
Dim responseArray As Byte() = myWebClient.UploadValues _
(uriString, "POST", myNameValueCollection)
' Response.Redirect("http://msdn.microsoft.com/")
End Sub
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Call DoPost()
End Sub

<form id="Form1" method="post" runat="server">
<P>
<asp:TextBox id="TextBox1" runat="server">test</asp:TextBox></P>
<P>
<asp:Label id="Label1" runat="server">Label</asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>

Ken
Microsoft MVP [ASP.NET]
Toronto

<Dennis E. Jones>; "Jr." <dj****@jcpenney.com> wrote in message
news:e1*************@TK2MSFTNGP09.phx.gbl...
I need to post an ASP.NET form between sites for report processing.
Site A contains the asp.net forms and site B contains Java Servlets for
report processing.

All form fields values must be passed to the reporting servlet via http
post method. No parameters can be transmitted by URL. The report must
display in a NEW browser window. Does anyone know how to set a target
using httpwebrequest or is there another alternative?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 19 '05 #2
Yes, that works...but I still need a solution for the target attribute.
Thanks for your help.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #3
If all you want is a submit button that opens your servlet in a new
window, .NET never comes into play:

<form action="yourServlet.jsp" target="_blank" method="post">
<input type=...>
<input type="submit">
</form>

Retarget your form from the HTML side.
Jason
http://www.expatsoftware.com

Nov 19 '05 #4
If I do not use .NET, then my server controls also go away.....I guess a
javascript injected into the page on postback would work, but only for
those browsers that support Javascript.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5

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

Similar topics

6
by: James Baker | last post by:
I have a form that contains another form. For some reason the "nested" form won't submit via document.FormName.submit(); it says "object is null or not a value" or something like that. When I...
5
by: Don | last post by:
I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is there some way, using JavaScript, to setup a <form> tag to do this? Thanks, Don ----==...
5
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post...
4
by: Rick | last post by:
Hello, I'm having trouble with submitting my form when checking to see if data is present in the user-inputted fields. What I want to happen is for the user to input various pieces of data,...
0
by: Mike Kingscott | last post by:
Totally hacked off here. I've written a user control that contains a text box, a required field validator and a button (these being the cornerstone of a search facility), all as ASP.Net server...
2
by: Syam | last post by:
Hello everyone, I am just barely two months old into learning asp.net and vb.net. Currently I am working on a project to store customer database. I have a question about creating a preview page:...
1
by: Hello | last post by:
Scenario: A page creates a pop up and that pop up submits a form. Is there a way to detect whether the submitting was successful or not, so true/false could be passed to the parent window?
1
by: SachinBhargava | last post by:
Hi, I am faceing the problem while submitting the same page in ASP. When i am submitting the page, I am showing the java script alert message before closing the pop up window. My problem is, when...
0
by: shival329 | last post by:
Hi, As we know there are a lot of ways to navigate to the another page such as using Response.Redirect, Server.Transfer,Server.Execute,& using context.handler . In all these cases we want to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.