开发者

Submit a form that is saved in a string (ASP.NET)?

开发者 https://www.devze.com 2023-01-12 07:48 出处:网络
I have a HTML form a string variable. e.g: there are below string in FormBody variable string. <form id=\'paymentUTLfrm\' action=\'...\' method=\'post\'>

I have a HTML form a string variable.

e.g: there are below string in FormBody variable string.

<form id='paymentUTLfrm' action='...' method='post'>
  <input type='hidden' name='CardAcqID' value='131211234234667' />
  <input type='hidden' name='AmountTrans' value='1' />
  <input type='hidden' name='ORDERID' value='1' />
  <input type='hidden' name='TerminalID' value='1723429902234254' />
  <input type='hidden' name='TimeStamp' value='1282408234231473657' />
  <input type='hidden' name='FP' value='56-85-2E-A6-F4-4B-7F-AD-17-E1-D9-97-D5-40-62' />
  <input type='hidden' name='RedirectURL' value='http://localhost:1903/Service1.asmx?op=MelliSale' />
  <input type='hidden' name='Merch开发者_运维知识库antAdditionalData' value='' />
  <input type='hidden' name='Version' value='3.22' />
</form>

Now I wanna submit it via ASP.NET and C# !!!

Could you please guide me how I can do it ?


see this page How to: Send Data Using the WebRequest Class

or do pablo answer


You need an HttpClient in C#. You can take a look at this MS support document with some help on how to do that or you can just use WebClient class.

With that Http Client, you will have to implement the POST HTTP command to send your data with application/x-www-form-urlencoded content type. That encoded data will contain each variable have in your string. To get their values, you will have to parse it.

0

精彩评论

暂无评论...
验证码 换一张
取 消