Alexo
Alexo

Reputation: 131

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="
    + 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

Upvotes: 1

Views: 3421

Answers (2)

Dean Chalk
Dean Chalk

Reputation: 20451

Take a look at the WebClient class

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

Upvotes: 1

Lobo
Lobo

Reputation: 4137

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

Regards!

Upvotes: 0

Related Questions