国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
記錄Cookie集合并讀取,可用于產(chǎn)品的最近訪問控制
using System;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text.RegularExpressions;
using System.Collections;



public partial class _Default : System.Web.UI.Page  
{
    SQLHelper.SQLHelp sh = new SQLHelper.SQLHelp();
    string sqlString = "";
    protected void Page_Load(object sender, EventArgs e)
    {
         if (Request.Cookies["username"] == null)
                {
                    HttpCookie myCookie = new HttpCookie("username");
                    myCookie.Values.Add("prodid", "");
                    myCookie.Expires = DateTime.Now.AddDays(1);
                    Response.Cookies.Add(myCookie);
                }

    }

    /////
    ///// 給網(wǎng)址加http://
    /////
    /////"_Cont">
    /////
    //   public static string String_UrlAddLink(string _Cont)  
    //    {  
    //        string StrRegex = @"(http://)?([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?";  
    //        Regex R = new Regex(StrRegex, RegexOptions.IgnoreCase);  
    //        _Cont = Regex.Replace(_Cont, StrRegex, "$0");  
    //        _Cont = _Cont.Replace("http://http://", "http://");  
    //        return _Cont;  
    //    }

       public void addcookie(string cookievalue)
       {
            
            HttpCookie cookie = new HttpCookie("username");
            if (Request.Cookies["username"].Values["prodid"] != "")
           {
                string myvalue = "";
                myvalue = Request.Cookies["username"].Values["prodid"].ToString();
                myvalue = cookievalue + "," + myvalue;
                cookie.Values.Add("prodid", myvalue);
                cookie.Expires = DateTime.Now.AddDays(1);
                Response.Cookies.Add(cookie);
            }

            else
           {
                cookie.Values.Add("prodid", cookievalue);
                cookie.Expires = DateTime.Now.AddDays(1);
                Response.Cookies.Add(cookie);
            }

        }


      public string playcookie()
       {
            int num = 0;
            string myvalue = "";
            myvalue = Request.Cookies["username"].Values["prodid"].ToString();
            string resultvalue=string.Empty;
            if (myvalue != "")
            {
                Char[] spitchar = new Char[] { Convert.ToChar(",") };
                string[] cookievalue;
                cookievalue = myvalue.Split(spitchar);
                if (cookievalue.Length <= 3)
                {
                    num = cookievalue.Length;
                }

                else
                {
                    num = 3;
                }

                for (int i = 0; i < num; i++)
                {
                    resultvalue += cookievalue[i].ToString()+";";
                }

                Label1.Text = resultvalue;
                
            }

            return resultvalue;
        }

       protected void btnUrl_Click(object sender, EventArgs e)
       {
           addcookie("1");
       }

       protected void Button1_Click(object sender, EventArgs e)
       {
           addcookie("2");
       }

       protected void Button2_Click(object sender, EventArgs e)
       {
           addcookie("3");
       }

       protected void Button3_Click(object sender, EventArgs e)
       {
           string[] anySqlStr = playcookie().Split(';');
           DataTable dtNew = new DataTable();
           DataColumn dc1 = new DataColumn("cid");
           DataColumn dc2 = new DataColumn("cName");
           dtNew.Columns.Add(dc1);
           dtNew.Columns.Add(dc2);
           DataRow drNew;
           foreach (string ss in anySqlStr)
           {
               drNew = dtNew.NewRow();
               if (ss != "")
               {
                   sqlString = "select * from city where cid=" + ss;
                   DataTable dt = sh.RunSQLReturnDs(sqlString).Tables[0];
                   drNew["cid"] = dt.Rows[0]["cid"].ToString();
                   drNew["cName"] = dt.Rows[0]["cName"].ToString();
                   dtNew.Rows.Add(drNew);
               }

               //Response.Write(ss+"");
           }

           GridView1.DataSource = dtNew;
           GridView1.DataBind();
       }

}

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
js/jsp操作cookie的方法
Android下對(duì)Cookie的讀寫操作(附Demo) | 望月聽濤
C#操作Cookie的幫助類
Asp.net的Session和Cookie傳值方式(轉(zhuǎn))
JSP中實(shí)現(xiàn)網(wǎng)站自動(dòng)登錄
JAVA讀取cookie的方法
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服