using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CarGallery
{
    public partial class AdminDefault : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            // inja avalin qesmatie ke bad az login varedesh mishe
            // aval inke ye parameter barash dar nazar gereftim be esme status , age behesh meqdare logout ro bedim
            // session e username ro az beyn mibare va logout mikone

            if (Request.Params["status"] == "logout")
                Session["username"] = null;

            // mohem tar az hame bayad check konim bebinim karbari ke varede in safhe mishe asan login karde ?!
            // pas migim age session e username null bood ya khali bood pas login nakarde , bargardoonesh be safhe login

            var sess = Session["username"];

            if (sess == null || sess == "")
                Response.Redirect("Login.aspx");
        }
    }
}