[英]Getting http post values
我遇到的這個問題是,我從外部站點向我的頁面加載了 http 發布數據,並且正在努力將其分開並處理它們,我在下面舉了一個例子:
我在下面得到了這個代碼,但是它在 c# 中,我使用的 web 應用程序是 vb.net。 我已經在網上搜索了幾天,他們在談論循環表單集合,但我沒有使用表單 collections 的經驗。
我可以通過使用 request("html") 獲得 html 和純文本,但是當我嘗試使用 request("envelope")("from") 時,它就不起作用了。
void Page_Load(object sender, EventArgs e) {
String from = Request.Form["envelope"]["from"];
String subject = Request.Form["headers"]["Subject"];
String plain = Request.Form["plain"];
String html = Request.Form["html"];
String reply = Request.Form["reply_plain"];
}
理想的情況是這樣的:
Dim subject as string = Request.Form["headers"]["Subject"]
任何幫助都會很棒
您應該能夠以這種方式訪問表單數據:
Dim plain As String
If Not string.IsNullOrEmpty(Request.Form("plain"))
Then
plain = Request.Form("plain")
End If
要訪問 header 數據,請使用Header
屬性而不是Form
Dim subject As String
If Not string.IsNullOrEmpty(Request.Header("Subject"))
Then
subject = Request.Header("Subject")
End If
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.