发送对第三方发出的HTTP POST的响应

时间:2015-05-19 15:46:49

标签: c# .net http post response

我正在与通过HTTP POST将信息发布到我在本地托管的.NET站点的第三方合作。 POST成功但我需要让站点向POST发送成功/失败响应。

我环顾四周,但一直无法找到满足这种需求的建议。

如果我能进一步澄清任何事情,请告诉我。

谢谢。

编辑:包含代码。

if (!string.IsNullOrEmpty(nvc["id"])  )
                { 
                    /* Populate the variables with the POST data
                     * Check first that the data is not empty or null */
                    if (!string.IsNullOrEmpty(nvc["id"]))
                    { leadID = nvc["id"]; }

                    if (!string.IsNullOrEmpty(nvc["FN"]))
                    { fn = nvc["FN"]; }

                    if (!string.IsNullOrEmpty(nvc["LN"]))
                    { ln = nvc["LN"]; }

                    if (!string.IsNullOrEmpty(nvc["EMAIL"]))
                    { email = nvc["EMAIL"]; }

                    if (!string.IsNullOrEmpty(nvc["PHONE"]))
                    { phone = nvc["PHONE"]; }

                    if (!string.IsNullOrEmpty(nvc["ADDRESS"]))
                    { address = nvc["ADDRESS"]; }

                    if (!string.IsNullOrEmpty(nvc["CITY"]))
                    { city = nvc["CITY"]; }

                    if (!string.IsNullOrEmpty(nvc["STATE"]))
                    { state = nvc["STATE"]; }

                    if (!string.IsNullOrEmpty(nvc["ZIP"]))
                    { zip = nvc["ZIP"]; }

                    if (!string.IsNullOrEmpty(nvc["GENDER"]))
                    { gender = nvc["GENDER"]; }

                    if (!string.IsNullOrEmpty(nvc["BIRTHDAY"]))
                    { birthday = nvc["BIRTHDAY"]; }

                    if (!string.IsNullOrEmpty(nvc["TB"]))
                    { tobacco = nvc["tobacco"]; }                    

                  //  if (!string.IsNullOrEmpty(nvc["PPCSource"]))
                  //  { PPCSource = nvc["PPCSource"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Source"]))
                    { GC_Source__c = nvc["GC_Source"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Medium"]))
                    { GC_Medium__c = nvc["GC_Medium"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Term"]))
                    { GC_Term__c = nvc["GC_Term"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Content"]))
                    { GC_Content__c = nvc["GC_Content"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Campaign"]))
                    { GC_Campaign__c = nvc["GC_Campaign"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Custom_Segment"]))
                    { GC_Custom_Segment__c = nvc["GC_Custom_Segment"]; }

                    if (!string.IsNullOrEmpty(nvc["GC_Num_of_Visits"]))
                    { GC_Num_of_Visits__c = nvc["GC_Num_of_Visits"]; }

                    googleCookie = "Source: " + GC_Source__c + "; Medium: " + GC_Medium__c + "; Term: " + GC_Term__c + "; Content: " + GC_Content__c + "; Camp: " + GC_Campaign__c + "; Segment: " + GC_Custom_Segment__c + "; Visits: " + GC_Num_of_Visits__c;

                    GC_Source__c = "PPCSource";                        

                    if (ln != null & !string.IsNullOrEmpty(ln))
                    {
                        /* Call SetClientFunction with the POST Parameters Passed */
                        string result = SetClient(leadID, fn, ln, email, phone, address,city, state, zip, gender, birthday, tobacco, PPCSource, googleCookie, 0, GC_Source__c, GC_Medium__c, GC_Term__c);
                        SendNotice(GC_Source__c, fn, ln, result);
                    }

0 个答案:

没有答案