Or, how to write these java functions in dotnet:
private String getAuthorization() {
String uidpwd = userID + ":" + password;
// Encode the user ID and password
byte[] inputBytes = uidpwd.getBytes();
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(inputBytes);
}
private void sendRequest(HttpURLConnection httpConnection
, String authorization
, String request) throws IOException {
httpConnection.setRequestProperty("Authorization", "BASIC " +
authorization);
httpConnection.setUseCaches(false);
PrintWriter writer = new
PrintWriter(httpConnection.getOutputStream());
writer.println(request);
writer.close();
}
String strAuth = getAuthorization();
StringBuffer sbufPost = new StringBuffer();
String fileContent = URLEncoder.encode(readXML(requestFile));
sbufPost.append("&Param1=" + fileContent);
// Create the Http connection
HttpURLConnection httpConnection = createConnection();
// Send the XML request
try {
sendRequest(httpConnection, strAuth, sbufPost.toString());
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn*************@ID-208219.news.uni-berlin.de...
* <Walter> scripsit: I need some help on a project that connects to a secure web server using
basic authentication and a Base64 encoded userid and password, and
posts a urlencoded xml file.
What are your questions?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>