I want to declare a integer variable in global scope but do not want to that its value become 0 every time the page is post-back

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Error : System.Web.UI.Page
{//should i declare here????
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

>I want to declare a integer variable in global scope

You can store value with global scope.

protected void Page_Load(object sender, EventArgs e)
    {
        Application.Lock();
        if(Application["key1"]==null) {
             Application["key1"]=10;
        }
        
        int n=(int)Application["key1"];
       Application.Unlock();
     }

use the

if(!Page.IsPostback)
{

}

yes you can declare there with static keyword.