View Single Post
  #1 (permalink)  
Old December 3rd, 2003, 04:23 PM
MichaelTJ MichaelTJ is offline
Authorized User
 
Join Date: Oct 2003
Location: , , Norway.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default HttpURLConnection from Java to ASPX???

Hi all you out there,
I'm making a page to send SMS from WEB, I've got a script in Java on how to do it.
But I'm making it in ASPX.
The first things in the script was ok to convert, but I can't find anywhere to convert
the URLConnection bit.. I've been looking around and all I could find was the
<configuration><system.web><authentication> to use in Web.config.
Is there anyway to do this in ASPX??

As always.. Thanks for all and any help out there.


********JAVA SCRIPT********************
String code = "XXXXXXXXXXXXXXXXXXXXXXXXXXXxx"

string from = "1900"

string to = "+46xxxxxxxx"

string msg = "Hello world"

String encoding = "ISO-8859-1"

StringBuffer sb = new StringBuffer();
sb.append("from" + from);
sb.append("&price=0");
sb.append("&type=text");
sb.append("&encoding=" + encoding);
sb.append("&to" = + URLEncoder.encode(to, "ISO-8859-1"));
sb.append("&data" = + URLEncoder.encode(msg, encoding));
String query = sb.toString();

URL url = new URL("http://mdfrisk.cpa.station.com:60000/sms?" + query);

****MY main problem is to do this part in VB.NET*****
//Set authorization header and request method
HttpURLConnection conn = (HttpURLConnection) url.openconnection();
conn.setRequestProperty("Authorization", "Basic " + code);
conn.setrequestMethode("GET");
conn.connect();

//Send the request and print the reply
System.out.printIn("Response code: " + conn.getResponseCode());
System.out.printIn("Response msg: " + conn.getResponseMessage());

BufferReader = br = new BufferReader(new InputStreamReader(conn.getInputStream()));
system.out.PrintIN("Body: " + br.readLine());
br.close();

------------------------
All help is Good help!
Regards
Michael
__________________
------------------------
All help is Good help!
Regards
Michael