当前位置: 首页>>代码示例>>C#>>正文


C# QueryString.Add方法代码示例

本文整理汇总了C#中QueryString.Add方法的典型用法代码示例。如果您正苦于以下问题:C# QueryString.Add方法的具体用法?C# QueryString.Add怎么用?C# QueryString.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryString的用法示例。


在下文中一共展示了QueryString.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldBuildHttpPostString

        public void ShouldBuildHttpPostString()
        {
            // arrange
            QueryString qs = new QueryString();
            qs.Add("1", "2");
            qs.Add("3", "4");

            // act and assert
            Assert.AreEqual("1=2&3=4", qs.ToString(HttpAction.Post));
        }
开发者ID:triggerfish,项目名称:Common,代码行数:10,代码来源:QueryStringTests.cs

示例2: Process

        public ActionResult Process(HttpRequestBase request, ModelStateDictionary modelState)
        {
            IpnVerificationBinder binder = new IpnVerificationBinder();
            Transaction tx = binder.Bind(request.Form, modelState);

            ContentResult cr = new ContentResult();
            cr.ContentEncoding = Encoding.UTF8;
            cr.ContentType = "text/html";
            cr.Content = "INVALID";

            if (tx != null)
            {
                Transaction dbTx = m_txRepository.GetAll().Where(x => x.Tx == tx.Tx).FirstOrDefault();
                if (dbTx != null)
                {
                    string expected = dbTx.ToIpnQueryString().ToString();
                    QueryString actualQs = new QueryString();
                    actualQs.Add(request.Form);
                    actualQs.Remove("cmd");
                    string actual = actualQs.ToString();

                    if (expected == actual)
                    {
                        cr.Content = "VERIFIED";
                    }
                }
            }

            return cr;
        }
开发者ID:triggerfish,项目名称:PayPalEmulator,代码行数:30,代码来源:AuthoriseIpnHandler.cs

示例3: MyFact

        public void MyFact()
        {
            var queryString = new QueryString();

            queryString.Add("q", "mcdonald");

            Assert.Equal("q=mcdonald", queryString.ToString());
        }
开发者ID:McDonaldConsulting,项目名称:Utility,代码行数:8,代码来源:QueryStringTests.cs

示例4: ShouldEncodeWhenConvertingToString

        public void ShouldEncodeWhenConvertingToString()
        {
            // arrange
            QueryString qs = new QueryString();
            qs.Add("1", "http://");

            // act and assert
            Assert.AreEqual("?1=http%3a%2f%2f", qs.ToString());
        }
开发者ID:triggerfish,项目名称:Common,代码行数:9,代码来源:QueryStringTests.cs

示例5: ShouldNotEncodeWhenAdding

        public void ShouldNotEncodeWhenAdding()
        {
            // arrange
            QueryString qs = new QueryString();
            qs.Add("1", "http://");

            // act and assert
            Assert.AreEqual("http://", qs["1"]);
        }
开发者ID:triggerfish,项目名称:Common,代码行数:9,代码来源:QueryStringTests.cs

示例6: ShouldDecodeWhenGettingValue

        public void ShouldDecodeWhenGettingValue()
        {
            // arrange
            QueryString qs = new QueryString();
            qs.Add("1", "http%3a%2f%2f");

            // act and assert
            Assert.AreEqual("http://", qs["1"]);
        }
开发者ID:triggerfish,项目名称:Common,代码行数:9,代码来源:QueryStringTests.cs

示例7: Delete

        /// <summary>
        /// 删除一个Catalog
        /// </summary>
        /// <param name="catalogId">Catalog的唯一标识</param>
        public void Delete(Int32 catalogId)
        {
            var qs = new QueryString();
            qs.Add("catalogId", catalogId.ToString());
            var deleteCata = client.HttpPost("/catalog/delete.api", qs);
            var jo = JObject.Parse(deleteCata);

            if (jo["statusCode"].ToString().CompareTo("0") != 0)
            {
                throw new PispowerAPIException(System.Int32.Parse(jo["statusCode"].ToString()), jo["message"].ToString());
            }
        }
开发者ID:OnecloudVideo,项目名称:csharp-sdk,代码行数:16,代码来源:CatalogService.cs

示例8: GetCdnDedicatedQuotas

		/// <summary>
		/// Return quota history
		/// <param name="period">To be written</param>
		/// <param name="serviceName">The internal name of your CDN offer</param>
		/// </summary>
		public async Task<OvhApi.Models.Cdnanycast.StatsDataType[]> GetCdnDedicatedQuotas(OvhApi.Models.Cdnanycast.StatsPeriodEnum period,string serviceName)
		{
			if(ConsumerKey == null)
				throw new OvhException("This request must be authenticated");
			Ensure.NotNull("period",period);
			Ensure.NotNullNorEmpty("serviceName",serviceName);

			var queryString = new QueryString();
			queryString.Add("period",period);


return await RawCall<OvhApi.Models.Cdnanycast.StatsDataType[]>(HttpMethod.Get,String.Format("/cdn/dedicated/{0}/quota{1}",System.Uri.EscapeDataString(serviceName.ToString()).Replace("%2B", "+"),queryString));
		}
开发者ID:biapar,项目名称:ovhapicil,代码行数:18,代码来源:Operations.cs

示例9: Add

        internal static string Add(this PathString path, object value)
        {
            var parameters = value.GetType().GetProperties().ToDictionary(x => x.Name, x => x.GetValue(value)?.ToString())
                .Where(x => x.Value.IsNotNullOrWhiteSpace());

            var query = new QueryString();

            foreach(var parameter in parameters) {
                query = query.Add(parameter.Key, parameter.Value);
            }

            return path.Add(query);
        }
开发者ID:migrap,项目名称:Tradier,代码行数:13,代码来源:Extensions.cs

示例10: EncryptQueryString

 public static QueryString EncryptQueryString(QueryString queryString)
 {
     QueryString newQueryString = new QueryString();
     string nm = String.Empty;
     string val = String.Empty;
     foreach (string name in queryString)
     {
         nm = name;
         val = queryString[name];
         newQueryString.Add(Encryption.Hex(nm),Encryption.Hex(val));
     }
     return newQueryString;
 }
开发者ID:idpsdashboard,项目名称:idpsdashboard,代码行数:13,代码来源:Security.cs

示例11: DecryptQueryString

 public static QueryString DecryptQueryString(QueryString queryString)
 {
     QueryString newQueryString = new QueryString();
     string nm;
     string val;
     foreach (string name in queryString)
     {
         nm = Encryption.DeHex(name);
         val = Encryption.DeHex(queryString[name]);
         newQueryString.Add(nm, val);
     }
     return newQueryString;
 }
开发者ID:idpsdashboard,项目名称:idpsdashboard,代码行数:13,代码来源:Security.cs

示例12: CreateSignedUrl

        private string CreateSignedUrl()
        {
            SignedRequestHelper helper = new SignedRequestHelper(Configuration.AWSAccessKeyId, Configuration.AWSSecretAccessKey, Constants.AWSUrl);

            QueryString query = new QueryString();
            query.Add("Service", "AWSECommerceService");
            query.Add("AssociateTag", Configuration.AWSAID);
            query.Add("Version", "2011-08-01");
            query.Add("ResponseGroup", "Images,Small");
            query.Add("Operation", "ItemSearch");
            query.Add("SearchIndex", ItemType.ToString());
            query.Add(SearchType.ToString(), Uri.EscapeDataString(Keywords));

            var signedUrl = helper.Sign(query);
            return signedUrl;
        }
开发者ID:sondreb,项目名称:InTheBoks,代码行数:16,代码来源:ItemService.cs

示例13: Add

        /// <summary>
        /// 增加一个Catalog
        /// </summary>
        /// <param name="name">Catalog的名字</param>
        /// <returns>Catalog 包含id,name字段,但videoNumber字段的值为空</returns>
        public Catalog Add(String name)
        {
            var qs = new QueryString();
            qs.Add("name", name);
            var createCata = client.HttpPost("/catalog/create.api", qs);
            var jo = JObject.Parse(createCata);

            if (jo["statusCode"].ToString().CompareTo("0") == 0)
            {
                var cata = new Catalog();
                cata.Name = jo["name"].ToString();
                var id = jo["id"].ToString();
                cata.Id = System.Int32.Parse(id);
                return cata;
            }
            else
            {
                throw new PispowerAPIException(System.Int32.Parse(jo["statusCode"].ToString()), jo["message"].ToString());
            }
        }
开发者ID:OnecloudVideo,项目名称:csharp-sdk,代码行数:25,代码来源:CatalogService.cs

示例14: Get

        /// <summary>
        /// 根据id查询Catalog
        /// </summary>
        /// <param name="catalogId">Catalog的唯一标识</param>
        /// <returns>Catalog 包含name,videoNumber字段, 但id字段的值为空</returns>
        public Catalog Get(Int32 catalogId)
        {
            QueryString qs = new QueryString();
            qs.Add("catalogId", catalogId.ToString());
            var getCata = client.HttpGet("/catalog/get.api", qs);
            var jo = JObject.Parse(getCata);

            if (jo["statusCode"].ToString().CompareTo("0") == 0)
            {
                Console.WriteLine("name:" + jo["name"]);
                var cata = new Catalog();
                cata.Name = jo["name"].ToString();
                var videoNum = jo["videoNumber"].ToString();
                cata.VideoNumber = System.Int32.Parse(videoNum);
                return cata;
            }
            else
            {
                throw new PispowerAPIException(System.Int32.Parse(jo["statusCode"].ToString()), jo["message"].ToString());
            }
        }
开发者ID:OnecloudVideo,项目名称:csharp-sdk,代码行数:26,代码来源:CatalogService.cs

示例15: GetHostingWebOffercapabilities

		/// <summary>
		/// Get offer capabilities
		/// <param name="offer">Describe offer capabilities</param>
		/// </summary>
		public async Task<OvhApi.Models.Hosting.Web.Capabilities> GetHostingWebOffercapabilities(OvhApi.Models.Hosting.Web.OfferCapabilitiesEnum offer)
		{
			if(ConsumerKey == null)
				throw new OvhException("This request must be authenticated");
			Ensure.NotNull("offer",offer);

			var queryString = new QueryString();
			queryString.Add("offer",offer);


return await RawCall<OvhApi.Models.Hosting.Web.Capabilities>(HttpMethod.Get,String.Format("/hosting/web/offerCapabilities{0}",queryString));
		}
开发者ID:biapar,项目名称:ovhapicil,代码行数:16,代码来源:Operations.cs


注:本文中的QueryString.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。