本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Specialized.NameValueCollection.Clear方法的具体用法?C# System.Collections.Specialized.NameValueCollection.Clear怎么用?C# System.Collections.Specialized.NameValueCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了System.Collections.Specialized.NameValueCollection.Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Check
public ActionResult Check()
{
var code = Request.Form["code"];
var text = Request.Form["text"];
var wc = new xWebClient();
if (Session["cookies"] != null)
wc.CookieContainer = Session["cookies"] as CookieContainer;
var values = new System.Collections.Specialized.NameValueCollection();
values.Add("code", code);
values.Add("textfield", text);
var str = wc.UploadValues("http://gsxt.gdgs.gov.cn/aiccips/CheckEntContext/checkCode.html", values);
var json = JObject.Parse(str);
if ((int)json["flag"] != 1)
return Content("验证码错误");
values.Clear();
values.Add("code", code);
values.Add("textfield", (string)json["textfield"]);
var htmlStr = wc.UploadValues("http://gsxt.gdgs.gov.cn/aiccips/CheckEntContext/showInfo.html", values);
var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(htmlStr);
var nodes = doc.DocumentNode.SelectNodes("//div[@class='list']/ul");
var list = new List<object>();
foreach (var node in nodes)
{
var li1 = node.SelectSingleNode("li[1]/a");
var li2 = node.SelectSingleNode("li[2]");
var o = new { name = li1.InnerText, brief = li2.InnerText, data = li1.Attributes["href"].Value };
list.Add(o);
}
return Content(JsonConvert.SerializeObject(list));
}
示例2: PostPictureOnFriendWall
//.........这里部分代码省略.........
//GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
try
{
disable_location_sharing = GlobusHttpHelper.getBetween(Response, "disable_location_sharing\\\" value=\\\"", "\\\"");
}
catch (Exception ex)
{
//GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection();
nvc.Add("fb_dtsg", fb_dtsg);
nvc.Add("source", source);
nvc.Add("profile_id", UserId);
nvc.Add("grid_id", gridid);
nvc.Add("qn", qn);
nvc.Add("0", localImagePath);
nvc.Add("upload_id","1025");
string response = string.Empty;
try
{
response = HttpHelper.HttpUploadPictureForWallNew(ref HttpHelper, UserId, "https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=" + FriendID + "&__av=" + UserId + "&__user=" + UserId + "&__a=1&__dyn=7n8ajEAMBlynzpQ9UoHaEWCueyp9Esx6iWF29aGEVFLFwxBxCbzESu49UJ6K4bBw&__req=13&fb_dtsg=" + fb_dtsg + "&ttstamp=26581728812272951201044890108&__rev=1391091" + UserId + "&__a=1&fb_dtsg=" + fb_dtsg, "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword, picfilepath);
composer_unpublished_photo = GlobusHttpHelper.getBetween(response, "fbid\":\"", "\"");
//fb_dtsg = Utils.getBetween(response, "fb_dtsg\\\" value=\\\"", "\\\"");
}
catch (Exception ex)
{
//GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
if (string.IsNullOrEmpty(response))
{
try
{
response = HttpHelper.HttpUploadPictureForWall(ref HttpHelper, UserId, FBGlobals.Instance.PostPicOnWallPostUploadPhotosUrl + UserId + "&__a=1&fb_dtsg=" + fb_dtsg, "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword, picfilepath);
}
catch (Exception ex)
{
//GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
}
else
{
nvc.Clear();
nvc.Add("composer_session_id","");
nvc.Add("fb_dtsg", fb_dtsg);
nvc.Add("xhpc_context", xhpc_context);
nvc.Add("xhpc_ismeta", xhpc_ismeta);
nvc.Add("xhpc_timeline", xhpc_timeline);
nvc.Add("xhpc_composerid", xhpc_composerid);
nvc.Add("xhpc_targetid", FriendID);
nvc.Add("xhpc_publish_type", xhpc_publish_type);
nvc.Add("clp", "");
nvc.Add("xhpc_message_text", Message);
nvc.Add("xhpc_message", Message);
nvc.Add("composer_unpublished_photo[]", composer_unpublished_photo);
nvc.Add("album_type", album_type);
nvc.Add("is_file_form", is_file_form);
nvc.Add("oid","");
nvc.Add("qn", qn);
nvc.Add("application", application);
nvc.Add("backdated_date[year]","" );
nvc.Add("backdated_date[month]", "");
nvc.Add("backdated_date[day]", "");
nvc.Add("backdated_date[hour]", "");
nvc.Add("backdated_date[minute]", "");
nvc.Add("is_explicit_place", "");
nvc.Add("composertags_place", "");
nvc.Add("composertags_place_name", "");
nvc.Add("tagger_session_id", tagger_session_id);
nvc.Add("action_type_id[]","");
nvc.Add("object_str[]", "");
nvc.Add("object_id[]", "");
nvc.Add("og_location_id[]", "");
nvc.Add("hide_object_attachment", hide_object_attachment);
nvc.Add("og_suggestion_mechanism", "");
nvc.Add("og_suggestion_logging_data", "");
nvc.Add("icon_id", "");
nvc.Add("composertags_city", "");
nvc.Add("disable_location_sharing", disable_location_sharing);
nvc.Add("composer_predicted_city","");
}
string responsestring = HttpHelper.HttpUploadPictureForWallNewFinal(ref HttpHelper, UserId, "https://upload.facebook.com/media/upload/photos/composer/?__av="+UserId+"&__user="+UserId+"&__a=1&__dyn=7n8ajEAMBlynzpQ9UoHaEWCueyp9Esx6iWF29aGEVFLFwxBxCbzESu49UJ6K4bBw&__req=o&fb_dtsg="+fb_dtsg+"&ttstamp=26581691188750571181101086979&__rev=1391091", "file1", "image/jpeg", localImagePath, nvc, proxyAddress, Convert.ToInt32(0), proxyUsername, proxyPassword, picfilepath);
if (responsestring.Contains("error") && !string.IsNullOrEmpty(responsestring))
{
//string resp = HttpHelper.postFormData(new Uri("https://www.facebook.com/ajax/places/city_sharer_reset.php"), "target_id=0&__user="+UserId+"&__a=1&__dyn=7n8ajEAMBlynzpQ9UoHaEWCueyp9Esx6iWF29aGEVFLFwxBxCbzESu49UJ6K4bBw&__req=r&fb_dtsg=AQEvW29vnlEO&ttstamp=26581691188750571181101086979&__rev=1391091");
isSentPicMessage = true;
}
}
catch (Exception ex)
{
//GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
}
return isSentPicMessage;
}
示例3: SignupManual
//.........这里部分代码省略.........
GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup - SignupMultiThreaded() -- Email Pass >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
}
try
{
RaiseEvent_AddToDictionary(Email);
}
catch (Exception ex) { Console.WriteLine(ex.StackTrace); }
try
{
if (IP.Split(':').Length == 4)
{
IPAddress = IP.Split(':')[0];
IPPort = IP.Split(':')[1];
IPUsername = IP.Split(':')[2];
IPpassword = IP.Split(':')[3];
}
}
catch (Exception ex)
{
Console.WriteLine("7 :" + ex.StackTrace);
GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup - SignupMultiThreaded() -- IP Split --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup - SignupMultiThreaded() -- IP Split >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
}
string url = "https://twitter.com/users/email_available?suggest=1&username=&full_name=&email=" + Email.Replace("@", "%40").Replace(" ", "") + "&suggest_on_username=true&context=signup";
string EmailCheck = globusHelper.getHtmlfromUrlIP(new Uri(url), IPAddress, IPPort, IPUsername, IPpassword, "https://twitter.com/signup", "");
if (EmailCheck.Contains("\"taken\":true"))
{
Log("[ " + DateTime.Now + " ] => [ Email : " + Email + " has already been taken. An email can only be used on one Twitter account at a time ]");
Created = false;
GlobusFileHelper.AppendStringToTextfileNewLine(emailData.Replace("\0", ""), Globals.path_EmailAlreadyTaken);
nvc.Clear();
return nvc;
}
//Get User name .....
try
{
username = username.Replace("\0", "");
Password = Password.Replace("\0", "");
if (!(username.Count() < 15 || Password.Count() > 6))
{
if (username.Count() > 15)
{
Log("[ " + DateTime.Now + " ] => [ Username Must Not be greater than 15 character ]");
username = username.Remove(13); //Removes the extra characters
}
else if (Password.Count() < 6)
{
Log("[ " + DateTime.Now + " ] => [ Password Must Not be less than 6 char ]");
}
}
}
catch (Exception ex)
{
Console.WriteLine("6 :" + ex.StackTrace);
GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> TwitterSignup - SignupMultiThreaded() -- Check Username --> " + ex.Message, Globals.Path_AccountCreatorErrorLog);
GlobusFileHelper.AppendStringToTextfileNewLine("Error --> TwitterSignup - SignupMultiThreaded() -- Check Username >>>> " + ex.Message + " || DateTime :- " + DateTime.Now, Globals.Path_TwtErrorLogs);
}
Random randm = new Random();
示例4: UpdateIssue
public void UpdateIssue(IssueUpdate update, NetworkCredential credential,
Action<string> stdout, Action<string> stderr)
{
var client = new Gurtle.WebClient();
System.Collections.Specialized.NameValueCollection data = new System.Collections.Specialized.NameValueCollection(1);
if (update.Comment.Length > 0)
{
data.Add("comment", update.Comment);
}
client.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(credential.UserName + ":" + credential.Password)));
client.UploadValues(CommentIssueUrl(update.Issue.Id), data);
data.Clear();
client.UploadValues(CloseIssueUrl(update.Status, update.Issue.Id), data);
}