0

Hi I am trying to achieve following in c# where I want to post xml data to a url where cxml-urlencoded is an hidden field.

<FORM METHOD=POST ACTION=<%= url%>>
<INPUT TYPE=HIDDEN NAME="cxml-urlencoded" VALUE="<% CreateCXML toUser,
fromUser, buyerCookie, unitPrice, supPartId, supPartAuxId, desc%>">
<INPUT TYPE=SUBMIT value=BUY>
</FORM>

I tried doing it

string  myurl=(uri+Server.UrlEncode(str1));
      Response.Write(@"<a input type=""hidden"" name=""cxml-urlencoded"" value=""myurl""></a>"); 
      Response.Close();

Any ideas how to best go about it?

user1108282
  • 65
  • 5
  • 10
  • I have no idea what the two code samples have to do with each other. What's `CreateCXML`? Where are you URL-encoding things? Where does the output of `Response.Write()` go? Why are you outputting obviously invalid HTML, with the literal `myurl`? – millimoose Oct 15 '12 at 22:26

1 Answers1

0

Insert a HiddenField server control in the page

<asp:HiddenField runat="server" ID="hdXML"/>

and set the value in the hidden fields from code behind as

hdXml.Value = CreateCXML(toUser, fromUser, buyerCookie, unitPrice, supPartId, supPartAuxId, desc);

Make sure you have the CreateCXML function declared and returning string.

Tariqulazam
  • 4,535
  • 1
  • 34
  • 42