Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"server">
Untitled Page
"form1" runat="server">
"Button1" runat="server" Text="Run" onclick="Button1_Click" />
"TextBox1" runat="server" Height="400px" Width="600px">
Default.aspx.cs:
using System;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string xml = "<?xml version='1.0' encoding='UTF-8'?>searchJobs100Open";
string url = "http://ww1.caliber.ie/cram/api";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
//string s = "id="+Server.UrlEncode(xml);
byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes(xml);
req.Method = "POST";
req.ContentType = "text/xml;charset=utf-8";
req.ContentLength = requestBytes.Length;
Stream requestStream = req.GetRequestStream();
requestStream.Write(requestBytes, 0, requestBytes.Length);
requestStream.Close();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
string backstr = sr.ReadToEnd();
TextBox1.Text = backstr;
sr.Close();
res.Close();
}
}
|