httppost到asp网络处理程序

时间:2016-04-25 03:24:38

标签: c# asp.net-mvc

我希望将对象数据从aspx.cs传递给asp.net处理程序,它将跨越另一个项目。任何评论都表示赞赏。

def sort(count_dict, avg_scores_dict, std_dev_dict):
    '''sorts and prints the output'''
    menu = menu_validate("You must choose one of the valid choices of 1, 2, 3, 4 \n        Sort Options\n    1. Sort by Avg Ascending\n    2. Sort by Avg Descending\n    3. Sort by Std Deviation Ascending\n    4. Sort by Std Deviation Descending", 1, 4)
    print ("{}{0:27}{0:39}{0:51}\n{}".format("Word", "Occurence", "Avg. Score", "Std. Dev.", "="*51))

    if menu == 1:       
        dic = OrderedDict(sorted(word_average_dict.items(), key=lambda x:x[1], reverse=False))
        for key in dic:
            print ("{}{0:27}{0:39:.4f}{0:51:.4f}".format(key, count_dict[key], avg_scores_dict[key], std_dev_dict[key])

    elif menu == 2:
        dic = OrderedDict(sorted(word_average_dict.items(), key=lambda x:x[1], reverse=True))
        for key in dic:
            print ("{}{0:27}{0:39:.4f}{0:51:.4f}".format(key, count_dict[key], avg_scores_dict[key], std_dev_dict[key])

    elif menu == 3:
        dic = OrderedDict(sorted(std_dev_dict.items(), key=lambda x:x[1], reverse=False))
        for key in dic:
            print ("{}{0:27}{0:39:.4f}{0:51:.4f}".format(key, count_dict[key], avg_scores_dict[key], std_dev_dict[key])

    elif menu == 4:
        dic = OrderedDict(sorted(std_dev_dict.items(), key=lambda x:x[1], reverse=True))
        for key in dic:
            print ("{}{0:27}{0:39:.4f}{0:51:.4f}".format(key, count_dict[key], avg_scores_dict[key], std_dev_dict[key])

    return None

对于项目B(TQueueDtcsController.cs)

//Project A  (abc.aspx.cs)
      try
      {
          String ltq_str = new JavaScriptSerializer().Serialize(ltq);

          int t = -1;
          String result = Gnuse.HTTPSend("http://localhost/is/TQueueDtcsController/integrationservice?tQueueDtcslist", HttpUtility.UrlEncode(ltq_str), ref t, "GET");


          if (!result.Equals("success"))
          {
              GRN.delete(Convert.ToInt32(hfId.Value), false);
              lblError.Text = "Inventory integration failed: " + result;
          }

      }

1 个答案:

答案 0 :(得分:0)

即使这是我的问题,但在我的朋友帮助我解决问题之后,我提供了这个问题的解决方案希望可以帮助某人。

    try
        {
            String ltq_str = new JavaScriptSerializer().Serialize(ltq);
            int t = -1;
            String result = Gnuse.HTTPSend("http://localhost/is/TQueueDtcs/integrationservice?tQueueDtcslist=", HttpUtility.UrlEncode(ltq_str), ref t, "GET");

            if (!result.Equals("success"))
            {
                GRN.delete(Convert.ToInt32(hfId.Value), false);
                lblError.Text = "Inventory integration failed: " + result;
            }
        }
        catch (Exception e)
        {
            e.Message.ToString();
        }

第1次更改:TQueueDtcsController>> TQueueDtcs因为无法直接指向包含该函数的确切.cs文件,但它应该指向使用此函数的页面。

第二个更改:添加'='以传递对象或值。