我有類似的要求發佈在這個問題。 How to open IE with post info in C#?如何在後導參數中跳過特殊字符導航方法
我試着用同樣的問題,由Andy S提供的答案。然而,我面臨的問題是我需要發送2個參數(在我的情況下請求和哈希),我不知道如何使用WebBrower的導航方法來實現這一點。
我試圖通過將字符串爲「請求通過後數據= ABC &哈希= 123" 和服務器似乎並沒有認識到的參數。
下面是一個工作
的HTML<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document Retrieval Service Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body onLoad="document.form1.submit();">
<form name="form1" method="post" action="http://abc.com/GetDoc/GetDoc.aspx">
<!--Request: -->
<input name="Request" type="hidden" id="request" value="ABC">
<!--Hash:-->
<input name="Hash" type="hidden" id="hash" value="123">
</form>
</body>
</html>
編輯:我能夠通過傳遞額外的參數給瀏覽方法,每在這個問題C# Post to browser fails, any ideas?提供了答案,使這項工作
不過,現在我面對的下一個問題是我特別字符放大器ersand & in Request Parameter。我嘗試在Request參數上使用System.Security.SecurityElement.Escape
,但是,它仍然無法識別其他參數。
EDIT2:我可以使它通過System.Web.HttpUtility.UrlEncode而不是使用System.Security.SecurityElement.Escape
感謝, Prabhjot
工作