如何在帖子webrequest中发送DOMAIN \ username

时间:2014-03-11 10:34:47

标签: c# post escaping webrequest

我有一个休息网络服务,我想在webrequest的正文中转移用户名。 用户名如下所示:DOMAIN \ robert.miller 但是来到服务器的用户名是DOMAINobertmiller。 它逃脱了弦!

这是我的代码如何发布字符串:

        byte[] body = new UTF8Encoding().GetBytes("\"" + changeAccount + "\"");

        HttpWebRequest httpWebRequest = WebRequest.CreateHttp(urlNActions);
        httpWebRequest.Method = "POST";
        httpWebRequest.ContentType = "application/json; charset=UTF-8";
        httpWebRequest.ContentLength = body.Length;
        httpWebRequest.Headers.Add("Authorization", "Basic " + userNameAndPw);
        httpWebRequest.GetRequestStream().Write(body, 0, body.Length);

0 个答案:

没有答案
相关问题