开发者

code from java to .net (c#)

ich have a little Problem to write a .net code. I have an example in java and want to convert it to .net!!

Java Code:

String url = "https://adwords.google.com/api/adwords/reportdownload?__rd="
    + 开发者_Python百科reportDefinitionId;
 HttpURLConnection urlConn = 
    (HttpURLConnection) new URL(url).openConnection();
urlConn.setRequestMethod ("GET");
urlConn.setRequestProperty("Authorization", "GoogleLogin auth="
    + user.getRegisteredAuthToken());
if (user.getClientCustomerId() != null) {
  urlConn.setRequestProperty("clientCustomerId", user.getClientCustomerId());
} else if (user.getClientEmail() != null) {
  urlConn.setRequestProperty("clientEmail", user.getClientEmail());
} else {
  urlConn.setRequestProperty("clientEmail", user.getEmail());
}
urlConn.connect();
copyStream(urlConn.getInputStream(), new FileOutputStream(
    new File(outputFileName)));

Thank you for Help!! If you need more Information, please ask me Alexo


Take a look at the WebClient class

http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx


You can see this post: http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22691600.html

Regards!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜