void Page_Load(object sender, EventArgs e){ if(Request.ServerVariables["SCRIPT_NAME"].Replace("/", "").Trim() == "test.aspx"){ Build_Function2(); } }It works on the page test.aspx but any other page it still seems to load the function and displays an error.
void Build_Function2(){ OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["ConnectionString"]); OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM Pages WHERE AreaID = 9 AND Main <> 1 ORDER BY Title;", myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds, "Pages"); MyHosting.DataSource = ds.Tables["Pages"].DefaultView; MyHosting.DataBind(); }Does Anybody Know What I am doing wrong?