One way to do this is to set the maximum size in web.config as has already been stated above e.g.
<system.web>
<httpRuntime maxRequestLength="102400" />
</system.web>
then when you handle the upload event, check the size and if its over a specific amount, you can trap it e.g.
protected void btnUploadImage_OnClick(object sender, EventArgs e)
{
if (fil.FileBytes.Length > 51200)
{
TextBoxMsg.Text = "file size must be less than 50KB";
}
}