Lorsque j'utilise PropertyInfo.SetValue dans asp.net, il génère une exception stackoverflow. que je vous écris ce code:Il déclenche une exception stackoverflow lorsque j'utilise PropertyInfo.SetValue()
for (int i = 0; i < rivalSeriesIDList.Count; i++)
{
cardb_series rivalSeries = seriesBll.GetSeriesInfoByID(rivalSeriesIDList[i].ToString());
this.GetType().GetProperty("brandid" + (i + 1)).SetValue(this, rivalSeries.brand_id, null);
this.GetType().GetProperty("seriesid" + (i + 1)).SetValue(this, rivalSeries.series_id, null);
}
Et brandid + nombre et seriesid + numéro est une propriété de aspx_page. comme ceci:
public int brandid1
{
get
{
if (Request.Form["brandid1"] != null)
return int.Parse(Request.Form["brandid1"]);
if (Request["brandid1"] != null)
return int.Parse(Request["brandid1"]);
return 0;
}
set
{
brandid1 = value;
}
}
quand je teste le code dans une application console, il est bien. Mais lorsque je le testerai dans une application Web, cela provoquera une exception de dépassement de pile. Je ne sais pas pourquoi. Parce que le web n'est pas un état? Merci.
Merci! Comme je suis folle! – user189594