UrlEncode() public method

public UrlEncode ( string s ) : string
s string
return string
Exemplo n.º 1
0
 public static void OutputExcel(System.Web.HttpServerUtility server, System.Web.HttpResponse response, string filename, MemoryStream ms)
 {
     byte[] bytes = ms.GetBuffer();
     response.Charset         = "UTF8";
     response.ContentEncoding = Encoding.UTF8;
     response.AddHeader("Content-Disposition",
                        "attachment; filename=" + server.UrlEncode(filename + ".xls"));
     response.ContentType = "application/vnd.ms-excel";
     response.BinaryWrite(bytes);
     response.End();
 }
Exemplo n.º 2
0
        public static void OutputExcel(System.Web.HttpServerUtility server, System.Web.HttpResponse response, string filename)
        {
            string path = server.MapPath(filename + ".xls");

            FileInfo file = new FileInfo(path);

            response.Clear();
            response.Charset         = "GB2312";
            response.ContentEncoding = Encoding.UTF8;
            response.AddHeader("Content-Disposition", "attachment; filename=" + server.UrlEncode(file.Name));
            response.AddHeader("Content-Length", file.Length.ToString());
            response.ContentType = "application/ms-excel";
            response.WriteFile(file.FullName);
            response.End();
        }
Exemplo n.º 3
0
 public override string UrlEncode(string s)
 {
     return(w.UrlEncode(s));
 }
Exemplo n.º 4
0
    /// <summary>
    /// 搜索店铺
    /// </summary>
    /// <returns></returns>
    public void SearchShops()
    {
        string page_url = "action=list";

        StringBuilder strHTML = new StringBuilder();

        QueryInfo Query = new QueryInfo();

        Query.PageSize    = 6;
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        if (Query.CurrentPage <= 0)
        {
            Query.CurrentPage = 1;
        }
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "SupplierShopInfo.Shop_Site", "=", pub.GetCurrentSite()));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "SupplierShopInfo.Shop_Status", "=", "1"));

        string keyword = tools.CheckStr(Request["keyword"]);

        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "SupplierShopInfo.Shop_Name", "like", keyword));
            page_url += "&keyword=" + Server.UrlEncode(keyword);
        }

        Query.OrderInfos.Add(new OrderInfo("SupplierShopInfo.Shop_ID", "ASC"));
        PageInfo pageinfo = myshop.GetPageInfo(Query);
        IList <SupplierShopInfo> entitys;

        strHTML.Append("<h2 class=\"title10\">共找到<strong>" + pageinfo.RecordCount + "</strong>条信息</h2>");

        if (pageinfo.RecordCount >= 1)
        {
            string       targetURL = string.Empty;
            SupplierInfo supplierInfo;
            entitys = myshop.GetSupplierShops(Query);

            if (entitys != null)
            {
                foreach (SupplierShopInfo entity in entitys)
                {
                    #region 循环体

                    supplierInfo = supplier.GetSupplierByID(entity.Shop_SupplierID);
                    if (supplierInfo == null)
                    {
                        supplierInfo = new SupplierInfo();
                    }

                    targetURL = supplier.GetShopURL(entity.Shop_Domain);

                    strHTML.Append("<div class=\"blk61\">");
                    strHTML.Append("	<div class=\"b61_left\">");
                    strHTML.Append("			<h2><a href=\""+ targetURL + "\" target=\"_blank\">" + entity.Shop_Name + "</a><span onclick=\"NTKF.im_openInPageChat('sz_" + (entity.Shop_SupplierID + 1000) + "_9999');\"><img style=\"display:inline-block; vertical-align:middle; margin-left:15px;width:74px;margin-right:10px;\" src=\"/images/icon04.png\"></span><span><a href=\"javascript:void(0);\">推广</a></span></h2>");
                    strHTML.Append("			<div class=\"b61_left_main\">");
                    strHTML.Append("				<ul>");
                    strHTML.Append("					<li><span>主营产品:</span>"+ entity.Shop_MainProduct + "</li>");
                    strHTML.Append("					<li><span>经营年限:</span>"+ supplierInfo.Supplier_OperateYear + "</li>");
                    strHTML.Append("					<li><span>所在地:</span>"+ addr.DisplayAddress(supplierInfo.Supplier_State, supplierInfo.Supplier_City, supplierInfo.Supplier_County) + "</li>");
                    strHTML.Append("					<li><span>注册资金:</span>"+ (supplierInfo.Supplier_RegisterFunds == 0 ? "无需验证" : supplierInfo.Supplier_RegisterFunds + "万") + "</li>");
                    strHTML.Append("				</ul>");
                    strHTML.Append("				<div class=\"clear\"></div>");

                    strHTML.Append("<p>");
                    IList <SupplierCertInfo> certs = supplier.GetSupplierCertByType(0);
                    if (certs != null)
                    {
                        int icert = 0;
                        foreach (SupplierCertInfo cert in certs)
                        {
                            if (supplier.Get_Supplier_Cert(cert.Supplier_Cert_ID, supplierInfo.SupplierRelateCertInfos).Length > 0)
                            {
                                icert++;

                                if (icert >= 2)
                                {
                                    strHTML.Append(" > ");
                                }

                                strHTML.Append(cert.Supplier_Cert_Name);
                            }
                        }
                    }
                    strHTML.Append("</p>");

                    strHTML.Append("			</div>");
                    strHTML.Append("	</div>");
                    strHTML.Append("	<div class=\"b61_right\">");
                    strHTML.Append("			<h2><a href=\""+ targetURL + "\" target=\"_blank\">进入本店铺 ></a></h2>");
                    strHTML.Append("			<div class=\"b61_right_main\">");
                    strHTML.Append("			<ul>");
                    strHTML.Append(ShopProducts(entity.Shop_SupplierID));
                    strHTML.Append("			</ul>");
                    strHTML.Append("			<div class=\"clear\"></div>");
                    strHTML.Append("			</div>");
                    strHTML.Append("	</div>");
                    strHTML.Append("	<div class=\"clear\"></div>");
                    strHTML.Append("	<em><img src=\"/images/div_bg.jpg\"></em>");
                    strHTML.Append("</div>");

                    #endregion
                }
            }
        }

        Response.Write(strHTML.ToString());

        page_url = Request.Path + "?" + page_url.TrimStart('&');
        pub.Page(pageinfo.PageCount, pageinfo.CurrentPage, page_url, pageinfo.PageSize, pageinfo.RecordCount);
    }
Exemplo n.º 5
0
    //会员登录
    public void Member_Login()
    {
        int chk_UserName = tools.CheckInt(Request["chk_UserName"]);

        Response.Cookies["BoHaiUserName"].Expires = DateTime.Now.AddYears(1);
        string Member_Username = tools.CheckStr(tools.NullStr(Request["member_name"]).Trim());
        string Member_Password = Request["member_password"];

        Member_Password = encrypt.MD5(Member_Password);
        if (tools.NullStr(Session["logintype"]) == "False")
        {
            string Trade_Verify = tools.CheckStr(Request["Trade_Verify"]);
            if (Trade_Verify != tools.NullStr(Session["Trade_Verify"]))
            {
                Session["logintype"] = "False";

                if (chk_UserName == 1)
                {
                    Response.Cookies["BoHaiUserName"].Value = Server.UrlEncode(Member_Username);
                }
                else
                {
                    Response.Cookies["BoHaiUserName"].Value = "";
                }
                //Response.Redirect("/member/login.aspx?login=vmsg");
                Response.Write("验证码错误");
                Response.End();
            }
        }
        if (Member_Username == "")
        {
            Session["logintype"] = "False";
            //Response.Redirect("/member/login.aspx?login=umsg_k");
            Response.Write("请输入您的用户名");
            Response.End();
        }
        MemberInfo memberinfo = MyMember.GetMemberByNickName(Member_Username, pub.CreateUserPrivilege("833b9bdd-a344-407b-b23a-671348d57f76"));

        if (memberinfo != null)
        {
            if (memberinfo.Member_Password != Member_Password)
            {
                Session["logintype"] = "False";

                if (chk_UserName == 1)
                {
                    Response.Cookies["BoHaiUserName"].Value = Server.UrlEncode(Member_Username);
                }
                else
                {
                    Response.Cookies["BoHaiUserName"].Value = "";
                }
                //Response.Redirect("/member/login.aspx?login=pmsg");
                Response.Write("密码错误");
                Response.End();
            }
            Response.Write("成功");
            Session["member_id"]             = memberinfo.Member_ID;
            Session["member_email"]          = memberinfo.Member_Email;
            Session["member_nickname"]       = memberinfo.Member_NickName;
            Session["member_logined"]        = "True";
            Session["member_logincount"]     = memberinfo.Member_LoginCount + 1;
            Session["member_lastlogin_time"] = memberinfo.Member_LastLogin_Time;
            Session["member_lastlogin_ip"]   = memberinfo.Member_LastLogin_IP;
            Session["member_coinremain"]     = memberinfo.Member_CoinRemain;
            Session["member_coincount"]      = memberinfo.Member_CoinCount;
            Session["member_grade"]          = memberinfo.Member_Grade;
            Session["Member_AllowSysEmail"]  = memberinfo.Member_AllowSysEmail;
            //Session["Member_Type"] = memberinfo.U_Member_Type;

            //if (chk_UserName == 1) { Response.Cookies["BoHaiUserName"].Value = Server.UrlEncode(memberinfo.Member_NickName); }
            //else { Response.Cookies["BoHaiUserName"].Value = ""; }

            //更新购物车价格
            Cart_Price_Update();

            //更新用户登录信息
            MyMember.UpdateMemberLogin(memberinfo.Member_ID, memberinfo.Member_LoginCount + 1, Request.ServerVariables["Remote_Addr"], pub.CreateUserPrivilege("833b9bdd-a344-407b-b23a-671348d57f76"));

            //更新会员等级
            Update_MemberGrade();

            Member_Log(memberinfo.Member_ID, "会员登录");

            //判断是否经过了邮件验证
            //if(memberinfo.Member_Emailverify==0)
            //{
            Session["member_emailverify"] = memberinfo.Member_Emailverify;
            //    //Response.Redirect("/member/emailverify.aspx");
            //    Response.Write("/member/emailverify.aspx");
            //}
            //else
            //{
            if (Session["url_after_login"] == null)
            {
                Session["url_after_login"] = "";
            }
            if (tools.NullStr(Session["url_after_login"].ToString()) != "")
            {
                //Response.Redirect(Session["url_after_login"].ToString());
                Response.Write(Session["url_after_login"].ToString());
            }
            else
            {
                //Response.Redirect("/member/index.aspx");
                Response.Write("/member/index.aspx");
            }
            //}
        }
        else
        {
            Session["logintype"] = "False";
            if (chk_UserName == 1)
            {
                Response.Cookies["BoHaiUserName"].Value = Server.UrlEncode(Member_Username);
            }
            else
            {
                Response.Cookies["BoHaiUserName"].Value = "";
            }
            //Response.Redirect("/member/login.aspx?login=umsg_w");
            Response.Write("账号未注册");
            Response.End();
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// See <see cref="HttpServerUtility"/> for a description.
 /// </summary>
 public string UrlEncode(string s)
 {
     return(_httpServerUtility.UrlEncode(s));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Take a comma-separated length of text and create links from it
        /// </summary>
        /// <param name="server">An <see cref="HttpServerUtility"/> for context information</param>
        /// <param name="stringCsvList">The comma-separated list of strings</param>
        /// <param name="urlFormat">a string.Format where {0} will be replaced with the search
        /// terms</param>
        /// <returns>A string containing search links to each of the comma-separated search values
        /// </returns>
        private string CreateSearchLinks(HttpServerUtility server,
            string stringCsvList,
            string urlFormat)
        {
            string[] items;
            if (stringCsvList.Contains(','))
            {
                items = stringCsvList.Split(',');
            }
            else
            {
                items = new string[1] { stringCsvList };
            }

            StringBuilder stringWithLinks = null;
            foreach (string stringItem in items)
            {
                string link = string.Format(urlFormat, server.UrlEncode(stringItem.Trim()));
                if (stringWithLinks != null)
                {
                    stringWithLinks.Append(", ");
                }
                else
                {
                    stringWithLinks = new StringBuilder();
                }
                stringWithLinks.AppendFormat("<a href=\"{0}\" target=\"_blank\">{1} <small><span class=\"glyphicon glyphicon-new-window\"></span></small></a>",
                   VirtualPathUtility.ToAbsolute(link),
                   stringItem.Trim());
            }
            return stringWithLinks.ToString();
        }