بدست آوردن اندازه ViewState یک صفحه ASP.Net
نویسنده: وحید نصیری
تاریخ: ۱۳۸۷/۱۰/۱۱ ۲۱:۴۲:۰۱
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
using System;
using System.Diagnostics;
using System.IO;
using System.Web.UI;
protected override void SavePageStateToPersistenceMedium(object state)
{
if (Debugger.IsAttached)
{
using (MemoryStream stream = new MemoryStream())
{
LosFormatter formatter = new LosFormatter();
formatter.Serialize(stream, state);
int size = stream.Capacity / 1024;
if (size > 32)
{
throw new Exception("لطفا به وضعیت ویوو استیت این صفحه رسیدگی نمائید");
}
}
}
base.SavePageStateToPersistenceMedium(state);
}
public partial class WebForm4 : System.Web.UI.Page
public partial class WebForm4 : MyPage