Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                Response.Redirect("../Error.aspx");
            }
        }
        PrevBrowCache.enforceNoCache();
        if (Session["UserId"] != null || Session["RoleID"].ToString() == "7")
        {
            state      = Session["StateCode"].ToString();
            user       = Session["UserId"].ToString();
            con        = Session["ConnKey"].ToString();
            Department = Session["Department"].ToString();
            username   = Session["UsrName"].ToString();

            if (!IsPostBack)
            {
                try
                {
                    random();
                    lblUser.Text = Session["Role"].ToString();
                    lblDate.Text = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
                    //BindGrid();
                    BindCategory();
                    lbltotal.Visible = false;
                    lbltotquantityAlloted.Visible = false;
                    gridid.Visible = false;
                    ObjCommon.BindFinancialYears(ddlYear);
                }
                catch (Exception ex)
                {
                    ExceptionLogging.SendExcepToDB(ex, Session["UserId"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
                    Response.Redirect("../Error.aspx");
                }
            }
        }
        else
        {
            Response.Redirect("../Error.aspx");
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.ServerVariables["HTTP_REFERER"] == null) || (Request.ServerVariables["HTTP_REFERER"] == ""))
        {
            Response.Redirect("~/Error.aspx");
        }
        else
        {
            string http_ref = Request.ServerVariables["HTTP_REFERER"].Trim();
            string http_hos = Request.ServerVariables["HTTP_HOST"].Trim();
            int    len      = http_hos.Length;
            if (http_ref.IndexOf(http_hos, 0) < 0)
            {
                Response.Redirect("../Error.aspx");
            }
        }
        PrevBrowCache.enforceNoCache();
        if (Session["UserId"] != null || Session["RoleID"].ToString() == "7")
        {
            state      = Session["StateCode"].ToString();
            user       = Session["UserId"].ToString();
            con        = Session["ConnKey"].ToString();
            Department = Session["Department"].ToString();
            username   = Session["UsrName"].ToString();
            //Label lbldept = (Label)header.FindControl("lbldept");
            //Label lblfooter = (Label)footer.FindControl("lbldept");
            //Image img = (Image)footer.FindControl("Image1");

            //lbldept.Text = "Department of Agriculture ,";
            //lblfooter.Text = "Department of Agriculture.";
            //img.ImageUrl = "~/Assets/img/doa.png";


            if (!IsPostBack)
            {
                try
                {
                    random();
                    lblUser.Text = Session["Role"].ToString();
                    lblDate.Text = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
                    //BindGrid();
                    BindCategory();
                    distdiv.Visible               = false;
                    alloteddiv.Visible            = false;
                    lbltotal.Visible              = false;
                    lbltotquantityAlloted.Visible = false;
                    gridid.Visible      = false;
                    lblDistCode.Visible = false;
                    ObjCommon.BindFinancialYears(ddlYear);
                }
                catch (Exception ex)
                {
                    ExceptionLogging.SendExcepToDB(ex, Session["UserId"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
                    ObjCommon.ShowAlertMessage(ex.ToString());
                }
            }
        }
        else
        {
            Response.Redirect("../Error.aspx");
        }
    }