473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help with small dotnet project

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.

Nov 20 '05 #1
7 2331
Hi Walter,

|| 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.

The more specific your questions, the better the chance of something
useful coming back.

How's about breaking that lot down and spreading them out over a period as
you develop your project. You may find it more effective to put some of your
questions to us here,
some in
news://msnews.microsoft.com/microsoft.public.dotnet.xml
and some in
news://msnews.microsoft.com/microsof...amework.aspnet.

Welcome to the groups, and see you later. ;-)

Regards,
Fergus
Nov 20 '05 #2
* <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>
Nov 20 '05 #3
Hto base64 encode in vb.net, how to authenticate to a web server using basic
authentication in vb.net
Thanks.
"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>

Nov 20 '05 #4
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>

Nov 20 '05 #5
* <Walter> scripsit:
Hto base64 encode in vb.net


'System.Convert.ToBase64String'.

--
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>
Nov 20 '05 #6
Thanks, that helps a lot. I have a C## snippet to do the basic
authentication. Now, my question is, how to send just a string, not a byte
array, is there something else beside httpwebrequest to use? Thanks.

I will post complete code if I get it up and running, this is to connect to
a Weblogic server.

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("https://secure.test.com");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization: Basic base64encodeduid:pwd");

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn*************@ID-208219.news.uni-berlin.de...
* <Walter> scripsit:
Hto base64 encode in vb.net


'System.Convert.ToBase64String'.

--
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>

Nov 20 '05 #7
* <Walter> scripsit:
Thanks, that helps a lot. I have a C## snippet to do the basic
authentication. Now, my question is, how to send just a string, not a byte
array, is there something else beside httpwebrequest to use? Thanks.

I will post complete code if I get it up and running, this is to connect to
a Weblogic server.

HttpWebRequest req =
(HttpWebRequest)WebRequest.Create("https://secure.test.com");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization: Basic base64encodeduid:pwd");


You can convert a string to a byte array using
'System.Text.Encoding.<...>.GetBytes'.

--
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>
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
0
by: Joe Bloggs | last post by:
Hi all, I take the pleasure to inform that Dotnet Commons Logging has been released for use. Dotnet Commons Logging, a subproject of the Donet Commons project currently located under the...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
1
by: Russ Wittmann | last post by:
I'm working on a small sql project to insert some job numbers, what I need to do is tell the user in a message box that the insert was either successful or unsuccessful, I am curious the best way...
2
by: Chris | last post by:
Hi, I have been stuck trying to come up with a design for days. I am working on a small project regarding barcode and I want to implement a factory design. I am now confused. I decided factory...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
6
by: HelpME | last post by:
I wrote a program in Vb.Net that was running fine. However I am unable to install it on a couple of machines. When i run it I get a windows error message that says My Project.exe has...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: sajin | last post by:
Hi All.. We are using VB .Net 2005 for implementing an API. API needs to generate events. For this client wants us to use Windows Callback (delegate implementation). The intention of using...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.