开发者

How do I pass username and password to an httpWebRequest in silverlight 4

开发者 https://www.devze.com 2023-01-21 07:46 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消