How do I pass username and password to an httpWebRequest in silverlight 4
How do I pass username and password to an HttpWebRequest in Silverlight 4.
since the HttpWebRequst class in silverlight does not implement 开发者_StackOverflow中文版Credentials property, therefore i am unable to authenticate my user.
one way I found was, to pass credentials in header using Authorization header, but it requires ASCII encoded value, which is not supported in Silverlight.
any other alternatives???
Perhaps you should just try it. All http headers are by specification ASCII. Hence the fact that HttpWebRequest
supports a Headers
collection that accepts a string for a header value implies that the string will be converted appropriately when sent in a HTTP session.
thanks, I got the solution, I had to write following line before creating the WebRequest object. :)
WebRequest.RegisterPrefix("http://":, WebRequestCreator.ClientHttp);
精彩评论