HttpWebResponse标头位置不包含查询字符串

时间:2016-12-27 21:59:24

标签: c# asp.net-web-api

我有以下代码:

        string getCustomerTokenUrl = "someurl?vi=7&vt=" + encryptedToken + "&DPLF=Y";
        HttpWebRequest objRequest = System.Net.HttpWebRequest.Create(getCustomerTokenUrl) as HttpWebRequest;
        objRequest.AllowAutoRedirect = false;

        try
        {
            HttpWebResponse response = objRequest.GetResponse() as HttpWebResponse;
            if (response.StatusCode == HttpStatusCode.Redirect ||
                response.StatusCode == HttpStatusCode.MovedPermanently)
            {
                Console.WriteLine(response.Headers["location"]);
            }
        }
        catch (System.Net.WebException ex)
        {
            Console.WriteLine(ex);
        }

当我运行代码时,我从位置标头获取一个值,但它缺少一个预期的查询字符串。

我得到了什么:

http://anotherurl.com/api/SSO/autoSWLLoginCT

如果我直接转到存储在getCustomerTokenUrl中的网址(在响应位置标头中),我在chrome开发人员工具中看到的内容:

http://anotherurl.com/api/SSO/autoSWLLoginCT?ct=dabe6dcd25385b7a77e3a1587cef9e6fee20e7af0952a4691ef2169ef9ec6704367626a647c07473ec2b3c98746b79cc66a646857c85930042a616db69442ca5

我配置错误会导致查询字符串被截断吗?

0 个答案:

没有答案