문제

My server requires us to post a header that include device ID to server, normally we can do some thing like this:

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_connectionURL);
        request.ContentType = "application/x-www-form-urlencoded";

        request.Headers.Add    // THIS METHOD DOESN'T EXIST in windows phone 7
        request.Method = "POST";

It has this method, which allows you to set available headers, but the header I want is not included there, how can I add another header to WebHeaderCollection.

request.Headers.AllKeys.SetValue //this function to set the available headers.
도움이 되었습니까?

해결책

request.Headers["MyHeaderName"] = "MyHeaderValue";

Some headers are restricted, such as Referrer, and will throw an exception.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top