To post can't you set the Method as Post and pack the header with the data in the Header Name/Value pairs?
Travis D. Falls |Consultant, Raft.Net IT | 860.547.4070 | [EMAIL PROTECTED] -----Original Message----- From: Dean Fiala [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 11:09 AM To: [email protected] Subject: Re: [AspNetAnyQuestionIsOk] asp.net HttpwebRequest problem Using the HttpWebRequest object to call a URL does not affect the browser, it does the call in code and streams the results back into the calling code. It is very handy for screen scraping or calling web services from your code. If you want to redirect from the browser, you need to use Reponse.Redirect(URL). You can pass parameters as part of the URL, like so... http://www.somesite.com/apage.cfm?Param1=AValue&Param2=AnotherValue If you want to post the parameters to the other page and redirect, it is a bit trickier in ASP.NET. The way I have found to do it is a javascript hack. You basically: 1) write out a dummy form in your page response that has the desired page as the post action 2) add the desired values in hidden input controls 3) then call the form submit method in javascript. Here's an example... Private Sub JavaScriptPostHack(URL as String, Value1 as String) Response.Write("<html><body>") Response.Write("<form name='PostForm' action='" & URL & "' method='POST' >") AddHiddenControl("Param1", Value1) Response.Write("&</form>") Response.Write("<script>") Response.Write("document.PostForm.submit();") Response.Write("</script>") Response.Write("</body></html>") End Sub Private Sub AddHiddenControl(ByVal Name As String, ByVal Value As String) Response.Write("<input type='hidden' name='" & Name & "' value='" & Value & "' >") End Sub When your page renders it will call the form submit and post to your desired URL with the supplied values. HTH -- Dean Fiala Very Practical Software, Inc http://www.vpsw.com Yahoo! Groups Links This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
