0

Hello I have a xml document in string that I am trying to post to a url.

 string xml = File.ReadAllText(Server.MapPath("~/test.txt"));
      myurl=(uri+Server.UrlEncode(xml));
       Response.Write("<a input type="hidden" name="cxml-urlencoded" value="myurl"></a>");

The Response.Write is not working as it is not properly written i get red wiggly underline starting hidden saying expected ")" Any ideas how to go about it? Thanks

user1108282
  • 65
  • 5
  • 10
  • 1
    Use the '@' character and double your quotes: `Response.Write(@"");` or escape your double quotes: `Response.Write("");` Vote to close; http://stackoverflow.com/questions/1928909/in-c-can-i-escape-a-double-quote-in-a-literal-string – dash Oct 15 '12 at 21:36
  • 1
    May I suggest, however, that a more readable solution would involve the following: `Response.Write(String.Format("", myurl));` as currently, you aren't concatenating the variable `myurl` in your string anyway. – dash Oct 15 '12 at 21:40
  • Actually I have a xml document that i need to post to a url using input= hidden name=cxml-url-encoded from c# whats the best way – user1108282 Oct 15 '12 at 21:46
  • " – dash" Isn't that redundant? Waltzing Ma~ – B. Clay Shannon-B. Crow Raven Feb 24 '14 at 22:55

1 Answers1

0

Try the mini-library I posted here. You'd use it like:

HTTP_Post(uri, Server.UrlEncode(xml), DataType.XML)

I don't know if it'd handle the specific field name you need to use, though.

Community
  • 1
  • 1
Bobson
  • 13,498
  • 5
  • 55
  • 80