Posting to web app and reading result

S

Stanley Beamish

Hello I'm an ASP newbie needing to translate a JAVA program into ASP. I
have a servlet that posts data to another servlet and reads back the
response. I was wondering how I could do the same in ASP. The bits of Java
code are:

HttpURLConnection conn = null;
try
{
URL url = new URL(urlStr);
System.out.println("Opening connection to: " + urlStr);
conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);

System.out.println("Sending data to url");
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.println(text);
out.close();

System.out.println("Reading response.");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer sb = new StringBuffer();

while ((inputLine = in.readLine()) != null)
{
sb.append(inputLine);
}

in.close();
System.out.println(sb.toString());
} catch (Exception e)
{
System.out.println(e.getMessage());
}

Any pointers greatly appreciated.

SB
 
J

Joerg Jooss

Stanley said:
Hello I'm an ASP newbie needing to translate a JAVA program into ASP.
I have a servlet that posts data to another servlet and reads back the
response. I was wondering how I could do the same in ASP. The bits
of Java code are:

ASP? Then you're wrong here.

ASP.NET? See System.Net.WebClient, which is an easy to use wrapper for
the lower level HttpWebRequest/HttpWebResponse classes.

Cheers,
 
M

Mark Rae

I was wondering how I could do the same in ASP.

You could start by posting your question in the correct newsgroup:
microsoft.public.inetserver.asp.general

This newsgroup is for ASP.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top