コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     User loggedUser = UserOpr.isLogged(Request);
     if (loggedUser == null)
     {
         LoginStatus.Text = "您未登录或登录过期,请重新登录,3秒后跳转到用户登录页面";
         LoginStatus.Visible = true;
         HtmlMeta RedirectMeta = new HtmlMeta(); //重定向用Meta标签
         RedirectMeta.HttpEquiv = "refresh"; //指定行为为跳转
         RedirectMeta.Content = "3;url=" + ReadWebConfig.GetAppSettingValue("LoginPageURL"); //时间为三秒,跳转到首页
         this.Page.Header.Controls.Add(RedirectMeta);
     }
     else
     {
         if (!Page.IsPostBack)
         {
             if (loggedUser.User_isChecked)
             {
                 //已激活
                 LoginStatus.Text = "您已经完成用户激活,无需再次激活";
                 LoginStatus.Visible = true;
             }
             else
             {
                 //未激活
                 UserOpr.SendVerifyMailToNewUser(loggedUser);
                 LoginStatus.Text = "确认信已经发往您登录时所用邮箱,请查收";
                 LoginStatus.Visible = true;
             }
         }
     }
 }
コード例 #2
0
 protected void lbkUnDisable_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(ddlUsers.SelectedValue))
     {
         if (Membership.GetUser(ddlUsers.SelectedValue).IsApproved == false)
         {
             MembershipUser user = Membership.GetUser(ddlUsers.SelectedValue);
             user.IsApproved = true;
             Membership.UpdateUser(user);
             if (Membership.GetUser(ddlUsers.SelectedValue).IsApproved == true)
             {
                 HtmlMeta meta = new HtmlMeta();
                 meta.HttpEquiv = "Refresh";
                 meta.Content = "2;url=ManageUser.aspx";
                 this.Page.Controls.Add(meta);                        
                 lblComment.Text = "<h4 style='color:green'>User " + ddlUsers.SelectedItem.Text + "'s account is now Undisabled</h4><br/><br/>You will now be redirected in 5 seconds";
             }
         }
         else
         {
             lblComment.Text = "<h4 style='color:green'>User " + ddlUsers.SelectedItem.Text + "'s account is not Disabled.</h4>";
         }
     }
     else
     {
         lblComment.Text = "<h4 style='color:red'>Please Select a User to Undisable</h4>";
     }
 }
コード例 #3
0
ファイル: Home-en.aspx.cs プロジェクト: htphongqn/kibitravel
        public void Bind_meta_tags_index()
        {
            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
                header.Title = _configs.ToList()[0].CONFIG_TITLE;

                headerDes.Content = _configs.ToList()[0].CONFIG_DESCRIPTION;
                header.Controls.Add(headerDes);

                headerKey.Content = _configs.ToList()[0].CONFIG_KEYWORD;
                header.Controls.Add(headerKey);
            }
            else
            {
                header.Title = "Enews Standard V1.0";

                headerDes.Content = "Enews Standard V1.0";
                header.Controls.Add(headerDes);

                headerKey.Content = "Enews Standard V1.0";
                header.Controls.Add(headerKey);
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "Đăng ký đại lý";

            if (!IsPostBack)
            {

                Load_city();
                Load_distric(-1);
                loadYear();
                loadMonth();
                loadDay();

            }
        }
コード例 #5
0
ファイル: Main.Master.cs プロジェクト: jgimness/cspad
        public void InitializePage(string _title, string _description, string _keywords, bool allowRobots)
        {
            string title = "cspad - C# pastebin and code snippets";
            title = title.Substring(0, 1).ToUpper() + title.Substring(1);
            Page.Title = title;

            HtmlMeta keywords = new HtmlMeta();
            keywords.Name = "keywords";
            keywords.Content = HttpUtility.HtmlAttributeEncode(_keywords) + "," +
                               "C#, C Sharp, code, programming, visual studio, snippets, source code";

            HtmlMeta description = new HtmlMeta();
            description.Name = "description";
            description.Content = _description == null ? "" : HttpUtility.HtmlAttributeEncode(_description);

            HeadPlaceHolder.Controls.AddAt(0, description);
            HeadPlaceHolder.Controls.AddAt(1, keywords);

            if (!allowRobots)
            {
                //<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
                HtmlMeta robots = new HtmlMeta();
                description.Name = "robots";
                description.Content = "NOINDEX, FOLLOW";
                HeadPlaceHolder.Controls.AddAt(2, description);
            }
        }
コード例 #6
0
ファイル: Meta.ascx.cs プロジェクト: goedings/VendorLink
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender(e);

            //if(!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Content))
            //{
            //    var metaTag = new HtmlMeta();
            //    metaTag.Name = Name;
            //    metaTag.Content = Content;
            //    Page.Header.Controls.Add(metaTag);
            //}

            if ((!string.IsNullOrEmpty(Name) || !string.IsNullOrEmpty(HttpEquiv)) && !string.IsNullOrEmpty(Content))
            {
                var metaTag = new HtmlMeta();

                if (!string.IsNullOrEmpty(HttpEquiv))
                    metaTag.HttpEquiv = HttpEquiv;
                if (!string.IsNullOrEmpty(Name))
                    metaTag.Name = Name;

                metaTag.Content = Content;

                if (InsertFirst)
                    Page.Header.Controls.AddAt(0, metaTag);
                else
                    Page.Header.Controls.Add(metaTag);
            }
		}
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid _guid = (Guid)Session["news_guid"];
            if (!IsPostBack)
            {
                Load_Cart(_guid);
                Lbtotal.Text =Lbtotal2.Text = fm.FormatMoney(cart.Total_Amount(_guid));

            }
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "Giỏ hàng";
        }
コード例 #8
0
 ///<summary>
 /// 添加Meta标签
 ///</summary>
 ///<param name="page">页面</param>
 ///<param name="name">名</param>
 ///<param name="content">正文</param>
 public void AddMeta(Page page, string name, string content)
 {
     System.Web.UI.HtmlControls.HtmlMeta meta = new System.Web.UI.HtmlControls.HtmlMeta();
     meta.Name    = name;
     meta.Content = content;
     page.Header.Controls.Add(meta);
 }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "Đăng ký";

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Utils.CStrDef(HttpContext.Current.Session["User_ID"])))
                {
                    Response.Redirect("trang-chu.html");
                }
                Loadcity();
                Loadyear();
            }
        }
コード例 #10
0
    /// <summary>
    /// Adds the post's tags as meta keywords.
    /// </summary>
    private void AddMetaKeywords()
    {
        if (Category.Categories.Count > 0)
        {
            string[] categories = new string[Category.Categories.Count];
            for (int i = 0; i < Category.Categories.Count; i++)
            {
                categories[i] = Category.Categories[i].Title;
            }

            string metakeywords = Server.HtmlEncode(string.Join(",", categories));
            System.Web.UI.HtmlControls.HtmlMeta tag = null;
            foreach (Control c in Page.Header.Controls)
            {
                if (c is System.Web.UI.HtmlControls.HtmlMeta && (c as System.Web.UI.HtmlControls.HtmlMeta).Name.ToLower() == "keywords")
                {
                    tag          = c as System.Web.UI.HtmlControls.HtmlMeta;
                    tag.Content += ", " + metakeywords;
                    break;
                }
            }
            if (tag == null)
            {
                base.AddMetaTag("keywords", metakeywords);
            }
        }
    }
コード例 #11
0
ファイル: intro.aspx.cs プロジェクト: htphongqn/ecobuild
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
                header.Title = "Giới thiệu";

                headerDes.Content = _configs.ToList()[0].CONFIG_DESCRIPTION;
                header.Controls.Add(headerDes);

                headerKey.Content = _configs.ToList()[0].CONFIG_KEYWORD;
                header.Controls.Add(headerKey);
            }
            else
            {
                header.Title = "Enews Standard V1.0";

                headerDes.Content = "Enews Standard V1.0";
                header.Controls.Add(headerDes);

                headerKey.Content = "Enews Standard V1.0";
                header.Controls.Add(headerKey);
            }
        }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _iUserID = Utils.CIntDef(Session["USER_ID"]);
                if (_iUserID == 0) Response.Redirect("/");
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "Thông tin cá nhân";
            if (!IsPostBack)
            {
                Load_city();
                Load_distric(-1);
                Loaduser_info();
            }
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Add meta info
            HtmlMeta meta1;

            meta1 = new HtmlMeta();
            meta1.Name = "robots";
            meta1.Content = "noindex, nofollow";
            Page.Header.Controls.Add(meta1);
            Page.Header.Controls.Add(new LiteralControl("\n"));

            //Show test label if organic link referer
            //Set session variable based on referer
            string useragentstring = "";
            if (Request.ServerVariables["HTTP_USER_AGENT"] != null)
                useragentstring = Request.ServerVariables["HTTP_USER_AGENT"].ToString().ToLower();

            Regex regEx_apple = new Regex("ipod|iphone|ipad");
            Regex regEx_android = new Regex("android");
            if (regEx_apple.Match(useragentstring).Success)
            {
                Response.Redirect("http://itunes.apple.com/us/app/best-pick-reports/id494057962?mt=8");
            }

            if (regEx_android.Match(useragentstring).Success)
            {
                Response.Redirect("https://play.google.com/store/apps/details?id=com.brotherfish");
            }
        }
コード例 #14
0
ファイル: Main-en.aspx.cs プロジェクト: htphongqn/ecobuild
        public void Bind_meta_tags_cat()
        {
            #region Bind Meta Tags
            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            //Face tags
            HtmlMeta propety = new HtmlMeta();
            HtmlMeta propetyTitle = new HtmlMeta();
            HtmlMeta propetyDesc = new HtmlMeta();
            //Twitter tags
            HtmlMeta propetyTw = new HtmlMeta();
            HtmlMeta propetyTitleTw = new HtmlMeta();
            HtmlMeta propetyDescTw = new HtmlMeta();

            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = Utils.CStrDef(Session["Cat_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["Cat_seo_keyword"]);

            if (string.IsNullOrEmpty(headerDes.Content))
            {
                headerDes.Content = "";
            }
            header.Controls.Add(headerDes);

            if (string.IsNullOrEmpty(headerKey.Content))
            {
                headerKey.Content = "";
            }

            header.Controls.Add(headerKey);
            //Facebook meta
            propety.Attributes.Add("property", "og:image");
            propety.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
            header.Controls.Add(propety);
            //Title
            propetyTitle.Attributes.Add("property", "og:title");
            propetyTitle.Content = Utils.CStrDef(Session["Cat_seo_title"]);
            header.Controls.Add(propetyTitle);
            //Desc
            propetyDesc.Attributes.Add("property", "og:description");
            propetyDesc.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyDesc);
            //Twitter meta
            propetyTw.Attributes.Add("property", "twitter:image");
            propetyTw.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
            header.Controls.Add(propetyTw);
            //Title
            propetyTitleTw.Attributes.Add("property", "twitter:title");
            propetyTitleTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyTitleTw);
            //Desc
            propetyDescTw.Attributes.Add("property", "twitter:description");
            propetyDescTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyDescTw);
            #endregion
        }
コード例 #15
0
ファイル: CssHelper.cs プロジェクト: aj-hc/SZY
 /// <summary>
 /// 添加Meta标签
 /// </summary>
 /// <param name="page">页面</param>
 /// <param name="name">Meta名字</param>
 /// <param name="content">Meta内容</param>
 public void AddMeta(System.Web.UI.Page page, string name, string content)
 {
     HtmlMeta meta = new HtmlMeta();
     meta.Name = name;
     meta.Content = content;
     page.Header.Controls.Add(meta);
 }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "Thanh toán";
            Guid _guid = (Guid)Session["news_guid"];
            if (!pay.Check_Cart(_guid))
            {
                Response.Redirect("/", false);
            }
            loadBanking();
            loadCast();
        }
コード例 #17
0
        public static string getKeywords(string strHTMLCode)
        {
            Regex metaregex = new Regex(@"<meta\s*(?:(?:\b(\w|-)+\b\s*(?:=\s*(?:""[^""]*""|'" +
                          @"[^']*'|[^""'<> ]+)\s*)?)*)/?\s*>", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
            List<HtmlMeta> MetaList = new List<HtmlMeta>();


            foreach (Match metamatch in metaregex.Matches(strHTMLCode))
            {
                HtmlMeta mymeta = new HtmlMeta();
                Regex submetaregex = new Regex(@"(?<name>\b(\w|-)+\b)\" +
                              @"s*=\s*(""(?<value>" +
                              @"[^""]*)""|'(?<value>[^']*)'" +
                              @"|(?<value>[^""'<> ]+)\s*)+",
                              RegexOptions.IgnoreCase |
                              RegexOptions.ExplicitCapture);


                foreach (Match submetamatch in submetaregex.Matches(metamatch.Value.ToString()))
                {
                    if (submetamatch.Groups["value"].ToString().ToLower() == "keywords")
                    {
                        //System.Windows.Forms.MessageBox.Show(submetamatch.NextMatch().Groups["value"].ToString().ToLower());
                        //System.Windows.Forms.MessageBox.Show(submetamatch.Groups["value"].ToString().ToLower());
                        //File.WriteAllText(Directory.GetCurrentDirectory() + "\\WebSource.txt", submetamatch.Groups["value"].ToString());
                        return submetamatch.NextMatch().Groups["value"].ToString();
                    }
                }
            }
            return "";
        }
コード例 #18
0
ファイル: UpdataPageView.cs プロジェクト: hoanghcmus/tomato
        public static void UpdataMetagMainTitle(System.Web.UI.Control PageView, string title)
        {
            if (title.Trim() == "")
                title = ConfigurationManager.AppSettings["title"];
            else
                title = title + " | " + ConfigurationManager.AppSettings["title"];
            PageView.Page.Title = title;

            HtmlMeta tagAuthor = new HtmlMeta();
            tagAuthor.Attributes.Add("name", "author");
            tagAuthor.Content = ConfigurationManager.AppSettings["author"];
            PageView.Page.Header.Controls.Add(tagAuthor);

            HtmlMeta tagKeywords = new HtmlMeta();
            tagKeywords.Attributes.Add("name", "Keywords");
            tagKeywords.Content = ConfigurationManager.AppSettings["keywords"];
            PageView.Page.Header.Controls.Add(tagKeywords);

            HtmlMeta tagDescription = new HtmlMeta();
            tagDescription.Attributes.Add("name", "description");
            tagDescription.Content = ConfigurationManager.AppSettings["description"];
            PageView.Page.Header.Controls.Add(tagDescription);

            HtmlMeta tagImage = new HtmlMeta();
            tagImage.Attributes.Add("name", "image");
            tagImage.Content = ConfigurationManager.AppSettings["image"];
            PageView.Page.Header.Controls.Add(tagImage);
        }
コード例 #19
0
        public void Bind_meta_tags_news()
        {
            #region Bind Meta Tags
            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            HtmlMeta propety = new HtmlMeta();

            headerDes.Name = "Description";
            headerKey.Name = "Keywords";
            header.Title = Utils.CStrDef(Session["News_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["News_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["News_seo_keyword"]);
            propety.Attributes.Add("property", "og:image");
            propety.Content = "caodangngheytebinhduong" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
            header.Controls.Add(propety);
            if (string.IsNullOrEmpty(headerDes.Content))
            {
                headerDes.Content = "";
            }
            header.Controls.Add(headerDes);

            if (string.IsNullOrEmpty(headerKey.Content))
            {
                headerKey.Content = "";
            }

            header.Controls.Add(headerKey);

            #endregion
        }
コード例 #20
0
        public void Bind_meta_tags_cat()
        {
            #region Bind Meta Tags
            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();

            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = Utils.CStrDef(Session["Cat_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["Cat_seo_keyword"]);

            if (string.IsNullOrEmpty(headerDes.Content))
            {
                headerDes.Content = "";
            }
            header.Controls.Add(headerDes);

            if (string.IsNullOrEmpty(headerKey.Content))
            {
                headerKey.Content = "";
            }

            header.Controls.Add(headerKey);
            #endregion
        }
コード例 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _id1 = Utils.CIntDef(Request["id1"]);
            _id2 = Utils.CIntDef(Request["id2"]);
            var _configs = cf.Config_meta();

            if (_configs.ToList().Count > 0)
            {
                if (!string.IsNullOrEmpty(_configs.ToList()[0].CONFIG_FAVICON))
                    ltrFavicon.Text = "<link rel='shortcut icon' href='" + PathFiles.GetPathConfigs() + _configs.ToList()[0].CONFIG_FAVICON + "' />";
            }

            HtmlHead header = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title = "So sánh";
            if (!IsPostBack)
            {
                getInfo(_id1, Hyname1, Hyperimg1, Lbdesc1, Lbprice1, Lbbaohanh1, Lbxuatxu1, lbthuonghieu1);
                getInfo(_id2, Hyname2, Hyperimg2, Lbdesc2, Lbprice2, Lbbaohanh2, Lbxuatxu2, lbthuonghieu2);
            }

        }
コード例 #22
0
        /// <summary>
        /// Registers a user given the textbox inputs
        /// </summary>
        protected void cmdRegister_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text != txtCPassword.Text)
            {
                Response.Write("Passwords do not match");
                return;
            }

            var mysql = new SqlConnector("db_trackvideowatching");

            var users =
                (DataTable)
                    mysql.Select("Select Username, EmailAddress From tbl_users WHERE Username = '******' OR EmailAddress = '" +
                                 txtEmail.Text + "';");
            if (users.Rows.Count != 0)
            {
                Response.Write("A user already exists with this username/email");
                return;
            }

            var salt = Utilities.GenerateSaltValue();

            var password = Utilities.HashPassword(txtPassword.Text, salt, MD5.Create());

            mysql.NonQuery("INSERT INTO tbl_users ( Username, Password_hash, Salt, EmailAddress) VALUES ('" +
                           txtUsername.Text + "','" + password + "','" + salt + "','" + txtEmail.Text + "');");

            HtmlMeta meta = new HtmlMeta();
            meta.HttpEquiv = "Refresh";
            meta.Content = "5;url=Login.aspx";
            Page.Controls.Add(meta);
            Response.Write("Account Creation Successfull, you will now be redirected");
        }
コード例 #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // Hack to make the html editing work on IE11.  Lame!
     System.Web.UI.HtmlControls.HtmlMeta m = new System.Web.UI.HtmlControls.HtmlMeta();
     Page.Header.Controls.Add(m);
     m.HttpEquiv = "X-UA-Compatible";
     m.Content   = "IE=10,chrome=1";
 }
コード例 #24
0
ファイル: checkUser.aspx.cs プロジェクト: 0daydigger/Avfun
        protected void Page_Load(object sender, EventArgs e)
        {
            User loggedUser = UserOpr.isLogged(Request);
            if (loggedUser == null)
            {
                //未登录
                CheckUserForm.Visible = false;
                lblLoginStatus.Text = "您未登录或者已经登录过期,请登录后再进行激活。3秒后转向登录页面";
                lblLoginStatus.Visible = true;

                //重定向
                HtmlMeta RedirectMeta = new HtmlMeta(); //重定向用Meta标签
                RedirectMeta.HttpEquiv = "refresh"; //指定行为为跳转
                RedirectMeta.Content = "3;url=" + ReadWebConfig.GetAppSettingValue("LoginPageURL"); //时间为三秒,跳转到首页
                this.Page.Header.Controls.Add(RedirectMeta);
            }
            if (loggedUser.User_isChecked)
            {
                //已经激活
                lblLoginStatus.Text = "您已经是激活用户,无需再次激活";
                lblLoginStatus.Visible = true;
            }
            else
            {
                lblLoginStatus.Visible = false;
                //获取Guid
                if (Request.QueryString["VerifyCode"] != null)
                {
                    try
                    {
                        //这里有可能出错所以要用try...catch
                        Guid userVerifyCode = new Guid(Request.QueryString["VerifyCode"]);
                        if (UserOpr.CheckUser(loggedUser, userVerifyCode))
                        {
                            //验证通过
                            lblCheckStatus.Text = "恭喜您,验证成功";
                            lblCheckStatus.Visible = true;
                        }
                        else
                        {
                            lblCheckStatus.Text = "验证码不符,请尝试重发确认信";
                            lblCheckStatus.Visible = true;
                        }

                    }
                    catch
                    {
                        lblCheckStatus.Text = "验证码格式不正确";
                        lblCheckStatus.Visible = true;
                    }
                }
                else
                {
                    lblCheckStatus.Text = "验证码不可以为空";
                    lblCheckStatus.Visible = true;
                }
            }
        }
コード例 #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string abc = Request.QueryString["abc"];

            int bibCount = ConvertDataTabletoString(abc);

            if (bibCount != 0)
            {
                //Data Source=184.168.194.70;Initial Catalog=ittitudeworks; User ID=rakesh123; Password=Rakesh@123; Trusted_Connection=False
                DataTable dt = new DataTable();
                using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
                {
                    using (SqlCommand cmd = new SqlCommand("select * from all_triathlon_timing where GUID='" + abc.ToString() + "'", con))
                    {
                        con.Open();
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        da.Fill(dt);

                        string bib = dt.Rows[0][1].ToString();
                        string name = dt.Rows[0][2].ToString();
                        string swim = dt.Rows[0][3].ToString();
                        string cycle = dt.Rows[0][4].ToString();
                        string run = dt.Rows[0][5].ToString();
                        string category = dt.Rows[0][6].ToString();
                        string total = dt.Rows[0][7].ToString();

                        HtmlMeta tag = new HtmlMeta();
                        tag.Attributes.Add("property", "og:title");
                        tag.Content = name;
                        Page.Header.Controls.Add(tag);

                        HtmlMeta tag1 = new HtmlMeta();
                        tag1.Attributes.Add("property", "og:description");
                        tag1.Content = "CTM 2014";
                        Page.Header.Controls.Add(tag1);

                        HtmlMeta tagurl = new HtmlMeta();
                        tagurl.Attributes.Add("property", "og:url");
                        tagurl.Content = "http://www.Chennaitrekkingclubevents.org/Certificates/Test/Images/AllImages/" + bib.Trim() + ".png";
                        Page.Header.Controls.Add(tagurl);

                        HtmlMeta tagimg = new HtmlMeta();
                        tagimg.Attributes.Add("property", "og:img");
                        tagimg.Content = "http://www.Chennaitrekkingclubevents.org/Certificates/Test/Images/AllImages/" + bib.Trim() + ".png";
                        Page.Header.Controls.Add(tagimg);

                        hfBib.Value = bib;
                        hfName.Value = name;
                        hfSwim.Value = swim;
                        hfCycle.Value = cycle;
                        hfRun.Value = run;
                        hfCategory.Value = category;
                        hfTotal.Value = total;
                    }
                }
            }
        }
コード例 #26
0
    public static void metaInclude(string key, string value, System.Web.UI.MasterPage masterPage)
    {
        using (System.Web.UI.HtmlControls.HtmlMeta meta_tag = new System.Web.UI.HtmlControls.HtmlMeta())
        {
            meta_tag.Attributes.Add(key, value);

            masterPage.Page.Header.Controls.Add(meta_tag);
        }
    }
コード例 #27
0
ファイル: PageExtension.cs プロジェクト: Artnman/Cloud
 /// <summary>
 /// Register the meta tag for this page
 /// </summary>
 /// <param name="page">the page</param>
 /// <param name="name">the meta tag name</param>
 /// <param name="content">the meta tag content</param>
 public static void RegisterMetaTag(this Page page, string name, string content)
 {
     var tag = new HtmlMeta
                   {
                       Name = name,
                       Content = content
                   };
     page.Header.Controls.Add(tag);
 }
コード例 #28
0
ファイル: PageUtility.cs プロジェクト: roczj/mixerp
 public static void AddMeta(Page page, string name, string content)
 {
     using (HtmlMeta meta = new HtmlMeta())
     {
         meta.Name = name;
         meta.Content = content;
         page.Header.Controls.Add(meta);
     }
 }
コード例 #29
0
        public static List<HtmlMeta> Parse(string htmldata)
        {
            Regex metaregex =
                new Regex(@"<meta\s*(?:(?:\b(\w|-)+\b\s*(?:=\s*(?:""[^""]*""|'" +
                          @"[^']*'|[^""'<> ]+)\s*)?)*)/?\s*>",
                          RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);

            List<HtmlMeta> MetaList = new List<HtmlMeta>();
            foreach (Match metamatch in metaregex.Matches(htmldata))
            {
                HtmlMeta mymeta = new HtmlMeta();

                Regex submetaregex =
                    new Regex(@"(?<name>\b(\w|-)+\b)\" +
                              @"s*=\s*(""(?<value>" +
                              @"[^""]*)""|'(?<value>[^']*)'" +
                              @"|(?<value>[^""'<> ]+)\s*)+",
                              RegexOptions.IgnoreCase |
                              RegexOptions.ExplicitCapture);

                foreach (Match submetamatch in submetaregex.Matches(metamatch.Value.ToString()))
                {
                    //System.Windows.Forms.MessageBox.Show(submetamatch.Groups["name"].ToString());
                    //System.Windows.Forms.MessageBox.Show(submetamatch.Groups["name"].ToString() + "\r\n" + submetamatch.Groups["value"].ToString());
                    /*if (submetamatch.Groups["name"].ToString().ToLower() == "content")
                    {
                        System.Windows.Forms.MessageBox.Show(submetamatch.Groups["value"].ToString().ToLower());
                        //mymeta.HttpEquiv = submetamatch.Groups["value"].ToString();
                        //File.WriteAllText(Directory.GetCurrentDirectory() + "\\WebSource.txt", submetamatch.Groups["value"].ToString());
                    }*/

                    if (submetamatch.Groups["value"].ToString().ToLower() == "keywords")
                    {
                        System.Windows.Forms.MessageBox.Show(submetamatch.NextMatch().Groups["value"].ToString().ToLower());
                        //System.Windows.Forms.MessageBox.Show(submetamatch.Groups["value"].ToString().ToLower());
                        //File.WriteAllText(Directory.GetCurrentDirectory() + "\\WebSource.txt", submetamatch.Groups["value"].ToString());
                    }
                        
                    /*if ("http-equiv" == submetamatch.Groups["name"].ToString().ToLower())
                        mymeta.HttpEquiv = submetamatch.Groups["value"].ToString();

                    if (("name" == submetamatch.Groups["name"].ToString().ToLower()) && (mymeta.HttpEquiv == String.Empty))
                        mymeta.Name = submetamatch.Groups["value"].ToString();

                    if ("scheme" == submetamatch.Groups["name"].ToString().ToLower())
                        mymeta.Scheme = submetamatch.Groups["value"].ToString();

                    if ("content" == submetamatch.Groups["name"].ToString().ToLower())
                    {
                        mymeta.Content = submetamatch.Groups["value"].ToString();
                        MetaList.Add(mymeta);
                    }*/
                }
            }
            return MetaList;
        }
コード例 #30
0
ファイル: BlogBasePage.cs プロジェクト: chandru9279/StarBase
 protected virtual void AddMetaContentType()
 {
     HtmlMeta meta = new HtmlMeta();
     meta.HttpEquiv = "content-type";
     // HTTP-EQUIV elements are used to specify system variables and are treated as part of the HTTP response header
     meta.Content = Response.ContentType + "; charset=" + Response.ContentEncoding.HeaderName;
     Page.Header.Controls.Add(meta);
     //eg:<meta http-equiv = "content-type" content = "text/css|etc; charset=utf-8|ascii|etc">
     //default content encoding can be specified in the <globalization> element in the Web.config
 }
コード例 #31
0
ファイル: ThonBasePage.cs プロジェクト: chandru9279/StarBase
        /// <summary>
        /// Not used here actually, just present for any future use:-)
        /// Except for SEO (using this to add keywords meta)
        /// </summary>
        protected virtual void AddMetaTag(string name, string value)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))
                return;

            HtmlMeta meta = new HtmlMeta();
            meta.Name = name;
            meta.Content = value;
            Page.Header.Controls.Add(meta);
        }
コード例 #32
0
        public HtmlMeta AddMetaTag(string name, string content)
        {
            HtmlMeta meta = new HtmlMeta();
            meta.Name = name;
            meta.Content = content;

            Page.Header.Controls.Add(meta);

            return meta;
        }
コード例 #33
0
		private static void SetCompatibleMeta(Page page, string metaContent)
		{
			if (IsCompatibleSet(page) == false)
			{
				HtmlMeta metaA = new HtmlMeta();
				metaA.HttpEquiv = "X-UA-Compatible";
				metaA.Content = metaContent;
				page.Header.Controls.AddAt(0, metaA);
			}
		}
コード例 #34
0
ファイル: Meta.cs プロジェクト: simonegli8/Silversite
        protected override void OnLoad(EventArgs e)
        {
            var meta = new HtmlMeta();
            foreach (string key in this.Attributes.Keys) {
                meta.Attributes.Add(key, Attributes[key]);
            }
            Controls.Add(meta);

            base.OnLoad(e);
        }
コード例 #35
0
    public static void metaInclude(System.Collections.Specialized.NameValueCollection metaAttributes, System.Web.UI.MasterPage masterPage)
    {
        using (System.Web.UI.HtmlControls.HtmlMeta meta_tag = new System.Web.UI.HtmlControls.HtmlMeta())
        {
            foreach (string key in metaAttributes.AllKeys)
            {
                meta_tag.Attributes.Add(key, metaAttributes.Get(key));
            }

            masterPage.Page.Header.Controls.Add(meta_tag);
        }
    }
コード例 #36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //2015.07.14 新增,若 IE 版本小於 8 ,或 IsLite=Y 則使用 Lite 版
        string strLiteURL = Request.Url.AbsoluteUri;

        strLiteURL = strLiteURL.Replace(".aspx", "Lite.aspx");

        if ((Util.getRequestQueryStringKey("IsLite", "N", true) == "Y") || (Util.getIEVersion() > 0 && Util.getIEVersion() < 8))
        {
            Response.Redirect(strLiteURL);
            return;
        }

        //2017.03.13 改用框架內建 jQuery
        Util.setJS(Util._JSjQueryUrl);

        //2015.07.16 調整,若未安裝 Flash Player 則使用 Lite 版
        Util.setJS_ChkFlashPlayer("", strLiteURL);

        //獨立設定MetaTag,不套用SecurePage的P3P設定,以免NetAP被套在ePortal的相容模式Frame時,檔案無法上傳 2015.01.06
        System.Web.UI.HtmlControls.HtmlMeta oMeta = new System.Web.UI.HtmlControls.HtmlMeta();
        oMeta.HttpEquiv = "X-UA-Compatible";
        oMeta.Content   = "IE=edge";
        this.Page.Header.Controls.Add(oMeta);

        //訂閱 uc 的事件
        ucAttachList1.AttachDeleted += new Util_ucAttachList.AttachDeletedClick(Event_AttachDeleted);

        //初始變數
        _AttachDB          = Util.getRequestQueryStringKey("AttachDB");
        _AttachID          = Util.getRequestQueryStringKey("AttachID");
        _AttachFileExtList = Util.getRequestQueryStringKey("AttachFileExtList", "", true);
        _AnonymousYN       = Util.getRequestQueryStringKey("AnonymousYN", "N", true);

        if (string.IsNullOrEmpty(_AttachDB) || string.IsNullOrEmpty(_AttachID))
        {
            DivUploadObj.Style["display"] = "none";
            DivListArea.Style["display"]  = "none";
            DivError.Style["display"]     = "";
            labErrMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError, "Parameter Error <ul><li>Require:<ul><li>AttachDB<li>AttachID</ul><li>Optional:<ul><li>AttachFileTotKB  []<li>AttachFileMaxQty [1]<li>AttachFileMaxKB [1024]<li>AttachFileExtList []<li>AnonymousYN [N]</ul></ul>");
        }

        if (!IsPostBack)
        {
            RefreshUploadInfo();
        }
    }
コード例 #37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //2017.01.20 新增可自訂上傳成功時的顯示訊息
        string strIsDoneMsg = Util.getRequestQueryStringKey("IsDoneMsg", RS.Resources.Upload_Complete_Close);

        //2015.07.14 新增,若 IE 版本小於 8 ,或 IsLite=Y 則使用 Lite 版
        string strLiteURL = Request.Url.AbsoluteUri;

        strLiteURL = strLiteURL.Replace(".aspx", "Lite.aspx");
        if ((Util.getRequestQueryStringKey("IsLite", "N", true) == "Y") || (Util.getIEVersion() > 0 && Util.getIEVersion() < 8))
        {
            Response.Redirect(strLiteURL);
            return;
        }

        //2017.03.13 改用框架內建 jQuery
        Util.setJS(Util._JSjQueryUrl);

        //2015.07.16 調整,若未安裝 Flash Player 則使用 Lite 版
        Util.setJS_ChkFlashPlayer("", strLiteURL);

        //獨立設定MetaTag,以免NetAP被套在 IE 相容模式 Frameset 時,檔案無法上傳
        System.Web.UI.HtmlControls.HtmlMeta oMeta = new System.Web.UI.HtmlControls.HtmlMeta();
        oMeta.HttpEquiv = "X-UA-Compatible";
        oMeta.Content   = "IE=edge";
        this.Page.Header.Controls.Add(oMeta);

        //初始變數
        _GUID = Util.getRequestQueryStringKey("GUID");
        _UploadFileExtList = Util.getRequestQueryStringKey("UploadFileExtList", "", true);
        _UploadFileMaxKB   = int.Parse(Util.getRequestQueryStringKey("UploadFileMaxKB", "1024"));

        if (Util.getRequestQueryStringKey("IsDone", "N", true) == "Y")
        {
            labMsg.Text          = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, strIsDoneMsg);
            DivMsg.Visible       = true;
            DivUploadObj.Visible = false;
        }
        else
        {
            DivMsg.Visible       = false;
            DivUploadObj.Visible = true;
            RefreshUploadInfo();
        }
    }
コード例 #38
0
        /// <summary>
        /// This method builds the page handler it's OG meta controls.
        /// </summary>
        private void BuildPageHandler()
        {
            #region Title

            /* OpenGraph Title */
            string openGraphTitle = String.Empty;
            try
            {
                openGraphTitle = openGraphModel.page.GetValue("LgszOpenGraphTitle").ToString();
            }
            catch (Exception) { }

            var metaOpenGraphTitle = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphTitle.Attributes.Add("name", "LgszOpenGraphTitle");
            metaOpenGraphTitle.Attributes.Add("property", "og:title");
            metaOpenGraphTitle.Content = !String.IsNullOrEmpty(openGraphTitle) ? openGraphTitle : openGraphModel.page.Title.ToString(); // If openGraphTitle is not null, do openGraphTitle, else take Page.Title

            //If the custom title is not null
            if (openGraphModel.ogTitle != null && openGraphModel.ogTitle != String.Empty)
            {
                metaOpenGraphTitle.Content = openGraphModel.ogTitle;
            }
            //Set in meta
            if (metaOpenGraphTitle.Content != String.Empty)
            {
                //metaOpenGraphTitle.Content = LogiszPageTitleHandler.AppendTitleWithCompanyName(metaOpenGraphTitle.Content);

                openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphTitle);
                openGraphModel.ogTitle = metaOpenGraphTitle.Content;
            }

            #endregion

            #region Description

            string openGraphDescription     = String.Empty;
            var    metaOpenGraphDescription = new System.Web.UI.HtmlControls.HtmlMeta();
            try
            {
                openGraphDescription = openGraphModel.page.GetValue("LgszOpenGraphDescription").ToString();
            }
            catch (Exception) { }
            metaOpenGraphDescription.Attributes.Add("name", "LgszOpenGraphDescription");
            metaOpenGraphDescription.Attributes.Add("property", "og:description");
            metaOpenGraphDescription.Content = openGraphDescription;

            if (String.IsNullOrEmpty(metaOpenGraphDescription.Content))
            {
                metaOpenGraphDescription.Content = openGraphModel.currentPageData.Description.ToString();
            }

            //If the custom title is not null
            if (openGraphModel.ogDescription != null && openGraphModel.ogDescription != String.Empty)
            {
                metaOpenGraphDescription.Content = openGraphModel.ogDescription;
            }

            if (String.IsNullOrEmpty(metaOpenGraphDescription.Content))
            {
                metaOpenGraphDescription.Content = openGraphDefaultDescription;
            }

            if (metaOpenGraphDescription.Content != String.Empty)
            {
                openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphDescription);
                openGraphModel.ogDescription = metaOpenGraphDescription.Content;
            }


            #endregion

            #region Image

            /* OpenGraph Image */
            var metaOpenGraphImage = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphImage.Attributes.Add("name", "LgszOpenGraphImage");
            metaOpenGraphImage.Attributes.Add("property", "og:image");
            IDataItem dataItem = null;
            try
            {
                dataItem = openGraphModel.page.GetRelatedItems("LgszOpenGraphImage").FirstOrDefault();
            }
            catch (Exception) { }
            if (dataItem != null)
            {
                var manager = LibrariesManager.GetManager();
                var image   = manager.GetImages().FirstOrDefault(i => i.Id == dataItem.Id);

                if (image != null)
                {
                    metaOpenGraphImage.Content = image.MediaUrl;
                }
            }
            else if (openGraphDefaultImage != String.Empty && openGraphDefaultImage != null)
            {
                var currentURL = openGraphModel.pageHandler.Request.Url.Scheme + System.Uri.SchemeDelimiter + openGraphModel.pageHandler.Request.Url.Host;
                metaOpenGraphImage.Content = currentURL + openGraphDefaultImage;
            }

            if (openGraphModel.ogImage != null && openGraphModel.ogImage != String.Empty)
            {
                metaOpenGraphImage.Content = openGraphModel.ogImage;
            }

            if (metaOpenGraphImage.Content != null && metaOpenGraphImage.Content != String.Empty)
            {
                openGraphModel.ogImage = metaOpenGraphImage.Content;
                openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphImage);
            }

            #endregion

            /* OpenGraph Locale */
            var metaOpenGraphLocale = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphLocale.Attributes.Add("name", "LgszOpenGraphLocale");
            metaOpenGraphLocale.Attributes.Add("property", "og:locale");
            metaOpenGraphLocale.Content = cultureName;
            openGraphModel.ogLocale     = metaOpenGraphLocale.Content;

            /* OpenGraph Site Name */
            var metaOpenGraphSiteName = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphSiteName.Attributes.Add("name", "LgszOpenGraphSiteName");
            metaOpenGraphSiteName.Attributes.Add("property", "og:site_name");
            metaOpenGraphSiteName.Content = companyName;
            openGraphModel.ogSiteName     = metaOpenGraphSiteName.Content;

            /* OpenGraph Site Name */
            var metaOpenGraphFbAppId = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphSiteName.Attributes.Add("name", "LgszOpenGraphFbAppId");
            metaOpenGraphSiteName.Attributes.Add("property", "fb:app_id");
            metaOpenGraphSiteName.Content = globalConfig.Modules.Opengraph.FbAppId;
            openGraphModel.ogFbAppId      = metaOpenGraphSiteName.Content;

            /* OpenGraph URL */
            var metaOpenGraphUrl = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphUrl.Attributes.Add("name", "LgszOpenGraphUrl");
            metaOpenGraphUrl.Attributes.Add("property", "og:url");
            metaOpenGraphUrl.Content = UrlPath.ResolveUrl(openGraphModel.pageHandler.Request.Path, true, true);;
            openGraphModel.ogUrl     = metaOpenGraphUrl.Content;

            /* OpenGraph Type */
            var metaOpenGraphType = new System.Web.UI.HtmlControls.HtmlMeta();
            metaOpenGraphType.Attributes.Add("name", "LgszOpenGraphType");
            metaOpenGraphType.Attributes.Add("property", "og:type");
            metaOpenGraphType.Content = "page";
            if (!String.IsNullOrEmpty(openGraphModel.ogType))
            {
                metaOpenGraphType.Content = openGraphModel.ogType;
            }

            openGraphModel.ogType = metaOpenGraphType.Content;
            openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphLocale);
            openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphSiteName);
            openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphUrl);
            openGraphModel.pageHandler.Header.Controls.Add(metaOpenGraphType);
        }