C#与VB如何互转?
sub Postgood(strID as string , StrPassword as string , Strvcode as string ) '这个是VB代码,用这个过程可以正常登陆QQ校友Strsenddata = "u=" & strID & "&p=" & _
StrPassword & "&verifycode=" & Strvcode & _
"&aid=15000102&u1=http%3A%2F%2Fxiaoyou.
Strsendadd = "http://ptlogin2.
Inet1.Execute Strsendadd, "POST", Strsenddata '发送信息
end sub
private void Postgood(string strID, string StrPassword, string Strvcode) //这个是C#代码,不知道哪里有问题,不能正常登陆哈!
{
string strUrl = "http://ptlogin2.{0}&p={1}&verifycode={2}&aid=15000102&u1=http%3A%2F%2Fxiaoyou.pengyou.
strUrl = string.Format(strUrl, strID , StrPassword , Strvcode );
Uri uri = new Uri(strUrl);
wr = (uri);
s = wr.GetResponse().GetResponseStream();
sr = new (s, Encoding.UTF8);
string ret = sr.ReadToEnd(); //读取返回信息
textBox4.Text = ret; //这里总是返回输入有误或系统繁忙!
}
以上两段代码分别是VB和c#写的,VB代码能够正常登陆QQ校友,而C#写的却不行,不知道什么原因,望高手指点!