按钮发送请求通过javascript命名' dopostback' ,在我的代码中我有这个功能:
private void dlProductDetail_ItemCommand(object source, DataListCommandEventArgs e)
{
object left = NewLateBinding.LateGet(e.CommandSource, null, "CommandName", new object[0], null, null, null);
if (Operators.ConditionalCompareObjectEqual(left, "DocDownload", false))
{
int docID = int.Parse(e.CommandArgument.ToString());
this.ForceDocDownload(docID);
}
else if (Operators.ConditionalCompareObjectEqual(left, "DocPurchased", false))
{
int num2 = int.Parse(e.CommandArgument.ToString());
if (SharedFunctions.DocHasBeenPurchasedByDocID(this.UserId, num2))
{
this.ForceDocDownload(num2);
}
}
else if (Operators.ConditionalCompareObjectEqual(left, "AddToWishList", false))
{
DataListItem item = e.Item;
WishList.AddProduct(this.PortalId, e.CommandArgument.ToString(), this.UserInfo);
this.DoAfterWishListRedirect();
}
else if (Operators.ConditionalCompareObjectEqual(left, "RemoveFromWishList", false))
{
DataListItem item3 = e.Item;
WishList.RemoveProduct(this.PortalId, e.CommandArgument.ToString());
this.DoAfterWishListRedirect();
}
}
当我在fiddler中检查标题数据时,我有这样的数据:
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="StylesheetManager_TSSM"
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="ScriptManager_TSM"
;;System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en:9775081d-3cde-400d-a4e8-b9cd8cdf4a51:ea597d4b:b25378d2
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__EVENTTARGET"
dnn$ctr494$ProductList$dlProductDetail$ctl00$docpurchasedlink1
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__EVENTARGUMENT"
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__VIEWSTATE"
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__VIEWSTATEGENERATOR"
CA0B0334
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__VIEWSTATEENCRYPTED"
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__EVENTVALIDATION"
fOIVD+nn+c54Ze/oTm31Q2zD15ye7T+OVXI9vjSGQIjAB1JhcMfiQNAYx/+RekdK1ikFDIGcBGPVUIJnv6+Rc/TrrIKWfy3Y3kOgCeI7ty52kPfTKfwv7Ks8F+fjFeez3lG0ZPeY08WtaoG9MTwaRDrRsYeNVysKfkT5bf7lVNL3mnlRYJQY1F2bvsV50EeeuoWO48Om96gix8MVtsXGI1WgWqEpaGbDZJaZV3Ovzbd5uPGg4oEgfAjTow6hiVmM1k1zQY9Pi2WsLZun
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="dnn$dnnSearch$txtSearch"
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="dnn$ctr494$ProductList$dlProductDetail$ctl00$hfModel"
84
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="ScrollTop"
800
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__dnnVariable"
`{`__scdoff`:`1`,`sf_siteRoot`:`/`,`sf_tabId`:`98`}
------WebKitFormBoundaryLdhbAgPnI7779ZQp
Content-Disposition: form-data; name="__RequestVerificationToken"
S8dMajopXeSPMN4yZOK3AD6WSx5wEwjG35vmuQ0gaYwml_tLG640bw97PiPiXd98WAfiM-A0SWreh5Bb0
------WebKitFormBoundaryLdhbAgPnI7779ZQp--
当我篡改Content-Disposition: form-data; name=dnn$ctr494$ProductList$dlProductDetail$ctl00$hfModel1
值时,我的表单数据没有任何变化。其中int.Parse(e.CommandArgument.ToString());
从表单发布数据中获取值?如你所见Content-Disposition: form-data; name=__EVENTARGUMENT
是空的! asp.net如何知道CommandArgument?!