示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //------------------------------------------------------------------------------------------------------------------------
            // Adding meta Discription
            HtmlMeta objMeta = new HtmlMeta();
            objMeta.Name    = "Description";
            objMeta.Content = WebConfig.GetValues("MetaDiscription");
            this.Header.Controls.Add(objMeta);
            //------------------------------------------------------------------------------------------------------------------------
            // Adding meta KeyWords
            objMeta         = new HtmlMeta();
            objMeta.Name    = "keywords";
            objMeta.Content = WebConfig.GetValues("MetaKeword");
            this.Header.Controls.Add(objMeta);
            //------------------------------------------------------------------------------------------------------------------------
        }
        else
        {
            //------------------------------------------------------------------------------------------------------------------------
            try
            {
                //------------------------------------------------------------------------------------------------------------------------
                // Is It By A Human
                L_CaptchaError.Visible  = false;
                L_UserNmeExists.Visible = false;

                if (TB_Captcha.Text.ToLower() == Session["CaptchaString"].ToString().ToLower())
                {
                    //Yes
                    //remove session
                    Session.Remove("CaptchaString");
                    // Checking Database for the avilable username
                    //------------------------------------------------------------------------------------------------------------------------
                    if (!MatrimonialMemberShip.CheckUserNameExsists(TB_ID.Text))
                    {
                        // Fine You get it
                        //------------------------------------------------------------------------------------------------------------------------
                        string strKey       = Crypto.EnCrypto(DateTime.Today.ToString() + "#" + TB_ID.Text.ToLower());
                        string strUrlEncode = Server.UrlEncode(strKey);
                        //Go To Registration Step 1
                        Server.Transfer("../Guest/Verification.aspx?id=r&key=" + strUrlEncode);
                        //------------------------------------------------------------------------------------------------------------------------
                    }
                    else
                    {
                        //--------------------------------------------------
                        // Someone else Owns that Try some other ID else
                        L_UserNmeExists.Visible = true;
                        //--------------------------------------------------
                    }
                    //------------------------------------------------------------------------------------------------------------------------
                }
                else
                {
                    //--------------------------------------------------
                    // Wrong Captch String
                    TB_Captcha.Text         = "";
                    L_CaptchaError.Visible  = true;
                    L_UserNmeExists.Visible = false;
                    //--------------------------------------------------
                }
            }
            catch (NullReferenceException)
            {
                //------------------------------------------------------------------------------------------------------------------------
                Response.Redirect("../Extras/ErrorReport.aspx?id=Section");
                //------------------------------------------------------------------------------------------------------------------------
            }
        } //IsPostBack
    }     // Load
 protected void Page_Load(object sender, EventArgs e)
 {
     //---------------------------------------------------------------------
     if (!IsPostBack)
     {
         //-----------------------------------------------------------------
         // Adding meta Discription
         HtmlMeta objMeta = new HtmlMeta();
         objMeta.Name    = "Description";
         objMeta.Content = WebConfig.GetValues("MetaDiscription");
         this.Header.Controls.Add(objMeta);
         //-----------------------------------------------------------------
         // Adding meta KeyWords
         objMeta         = new HtmlMeta();
         objMeta.Name    = "keywords";
         objMeta.Content = WebConfig.GetValues("MetaKeword");
         this.Header.Controls.Add(objMeta);
         //----------------------------------------------------------------
     }
     else
     {
         //----------------------------------------------------------------
         // Start Verifications
         try
         {
             //------------------------------------------------------------------------------
             // Checking Captch Image string
             //Works!!
             if (TB_Captcha.Text.ToLower() == Session["CaptchaString"].ToString().ToLower())
             {
                 //------------------------------------------------------------------------------
                 //remove session
                 L_Captcha.Visible = false;
                 Session.Remove("CaptchaString");
                 //------------------------------------------------------------------------------
                 //Checking UserName Exsists
                 //Yes
                 if (MatrimonialMemberShip.CheckUserNameExsists(TB_ID.Text))
                 {
                     //------------------------------------------------------------------------------
                     //Adding UserName Into Session For Sequrity
                     string strRandom = RandomString.GenerateStirng(5, false);
                     Session.Add(strRandom, TB_ID.Text);
                     // Transfer Control to Step 2
                     //Send Session Key to access UserName
                     Server.Transfer("~/Guest/AskQuestion.aspx?key=" + strRandom);
                     //------------------------------------------------------------------------------
                 }
                 else
                 {   //No Such User
                     //------------------------------------------------------------------------------
                     L_WPassword.Visible = true;
                     //------------------------------------------------------------------------------
                 }
             }
             else // Wrong Captcha
             {
                 //------------------------------------------------------------------------------
                 L_Captcha.Visible   = true;
                 TB_Captcha.Text     = "";
                 L_WPassword.Visible = false;
                 //------------------------------------------------------------------------------
             }
         }
         catch (NullReferenceException)
         {
             //Session Variable Expread
             //------------------------------------------------------------------------------
             Response.Redirect("../Extras/ErrorReport.aspx?id=Section");
             //------------------------------------------------------------------------------
         }
     }
 }