Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 向第三方发出的HTTP POST发送响应_C#_.net_Http_Post_Response - Fatal编程技术网

C# 向第三方发出的HTTP POST发送响应

C# 向第三方发出的HTTP POST发送响应,c#,.net,http,post,response,C#,.net,Http,Post,Response,我正在与第三方合作,他们通过HTTP POST将信息发布到我在本地托管的.NET站点。该职位是成功的,但我需要有网站发送一个成功/失败的回应后 我环顾四周,但找不到任何满足这一需要的建议 如果我能进一步澄清,请告诉我 多谢各位 编辑:包含代码 if (!string.IsNullOrEmpty(nvc["id"]) ) { /* Populate the variables with the POST data

我正在与第三方合作,他们通过HTTP POST将信息发布到我在本地托管的.NET站点。该职位是成功的,但我需要有网站发送一个成功/失败的回应后

我环顾四周,但找不到任何满足这一需要的建议

如果我能进一步澄清,请告诉我

多谢各位

编辑:包含代码

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);
                    }

如果您正在处理请求,您可以将响应状态代码设置为200 OK(或任何其他对该场景有意义的代码)。我想说,如果您已经运行了一个处理HTTP帖子的.NET站点,它可能已经提供了某种响应,因为您必须专门设计它以不提供响应,所以你问的有点不清楚。我从我的第三方收到的反馈是,他们在发布后超时了。虽然此应用程序接受帖子,但它似乎没有提供任何响应。我的问题是如何发送响应,而不是让站点超时,即使它正在成功地发布到我的服务器上。您的代码是否运行并成功地处理了它接收到的数据?我们能看到你的密码吗?是的,我能看到密码。此外,我设置了一个SMTP响应,以通知我邮件是否成功或失败。SMTP工作正常。对不起,我应该包括代码。我似乎不知道如何粘贴代码,而不让这个文本框太长。