Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2006, 06:56 AM
Authorized User
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default POST values and redirect

Hi All,

I have the following code which sends a POST to a webpage. This works fine but the problem I have is that I need to redirect to the page where the POST has been sent to. Can anyone help?

Server.Transfer and Redirect with querystring values are not options, the values must be in a POST and go to a webpage that I have no control over.

Please Help!!!:(

Dim encoding As New ASCIIEncoding
Dim postdata As String = "TestField=Brett123"
Dim data As Byte() = encoding.GetBytes(postdata)

Dim myReq As HttpWebRequest = WebRequest.Create("Default3.aspx")
myReq.Method = "POST"
myReq.ContentType = "application/x-www-form-urlencoded"
myReq.ContentLength = data.Length

Dim newStream As Stream = myReq.GetRequestStream
newStream.Write(data, 0, data.Length)
newStream.Close()

 
Old January 30th, 2006, 08:03 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii brettk_1!!
on page load write javascript code that submits the form to your specified page.

e.g.It is a asp code,even work fine in php/.net/jsp
<%
'Some coding
%>
<script>
function submitPage()
{
document.myform.submit();
}
</script>
<body onload="submitPage()">
<form name="myform" method="post" action="redirectedurl.aspx">
<input type=hidden name="firstname" value='<%=myname%>'>
</form>

Note:-1 you need to pass all the input values using hidden fields

Please let me know if you have other alternatives!!

Hope this will help you


Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form post page redirect problem - S.O.S. jroxit ASP.NET 1.0 and 1.1 Professional 4 May 21st, 2008 11:06 AM
how to post variable on response.redirect????? Swetz Classic ASP Components 3 May 16th, 2006 06:37 AM
problem reciving check box values using post metho method Pro PHP 1 March 10th, 2006 08:27 PM
POST values and redirect brettk_1 ASP.NET 1.0 and 1.1 Professional 1 January 30th, 2006 08:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.