0

I need to post data to other website using C#.

<form action="http://localhost:2180/PrepDoc.aspx" method="post" target="my_frame" > <input type="text" name="someText" value="Some Text" /> <input type="submit" runat="server" /> </form> <iframe id="myIframe" name="my_frame" runat="server" > 

this is working fine but i need to do this using c#.

can some one guide me before i was trying to post data using onclick button code but it takes to the prepdoc page that i dont want .

HttpResponse httpResponse = HttpContext.Current.Response; httpResponse.Clear(); httpResponse.Write("<html><head></head>"); httpResponse.Write(string.Format( "<body onload=\"document.{0}.submit()\">", "frmCart")); httpResponse.Write(string.Format( "<form name=\"{0}\" method=\"{1}\" action=\"{2}\" target=\"my_frame\">", "frmCart", "Post", "http://localhost:2180/PrepDoc.aspx")); httpResponse.Write("</form>"); httpResponse.Write("</body></html>"); httpResponse.End(); 

I want this to be on Default page (caller page) and in iFrame. Any help will be appreciated.

8
  • Is the HTML necessary? Can't you just do an Http Post? If so, take a look at this Commented May 21, 2013 at 17:59
  • i want to mention target for iframe how can i do that in http post ? Commented May 21, 2013 at 18:04
  • I'm not sure what you mean. Could you please clarify? Commented May 21, 2013 at 18:05
  • Are you just looking to include content from an external page into your existing page re: the iFrame or are you wanting to have a secondary page/form be available for interaction/posting within your main page? Commented May 21, 2013 at 18:05
  • @Pheonixblade9 i meant to say that i in http post if i want to mention target that i mentioned here action="localhost:2180/PrepDoc.aspx" method="post" target="my_frame" Commented May 21, 2013 at 18:08

2 Answers 2

0

a good resource is this page:

http://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.100).aspx

There you can find some code snippets, too. Enjoy.

Greetings Johnny

Sign up to request clarification or add additional context in comments.

Comments

0
Source page : Session("value") = value; Destination page : value = Session("Value"); 

2 Comments

Please add some context to explain this answer.
whatever you want send to the other page you can use that code, for example you wanna send result of the query or a integer or string, you can send it to the "session("Value")= value; " then in the Destination page receive it "value = Session("Value");"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.