I am trying to create a small application that will do开发者_高级运维wnload the content of a certain webpage. I am able to do that with certain web pages using WebRequest. However the web page I need to download from requires login information.
I am using C# and Visual Studio Express 2010
Thank you in advance...
Have a look at HttpWebRequest.Credentials.
You can either simply use HttpWebRequest.Credentials as CesarGon mentioned or if it's HTTP Basic authorization, add an appropriate HTTP header (that would be environment independent):
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
where dXNlcm5hbWU6cGFzc3dvcmQ= is base 64 encoded username:password.
加载中,请稍侯......
精彩评论